Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
314 views
in Technique[技术] by (71.8m points)

Import own Python module on Kaggle

I am new to this and very new to Kaggle.

I am trying to replicate this notebook:

https://www.kaggle.com/bibhash123/chest-x-ray-abnormalities-baseline-tf-keras

There one person wrote a module from utilities_x_ray

https://www.kaggle.com/bibhash123/utilities-x-ray

How to import it? It looks like utilities_x_ray is not directly specified in the second link.

As a result, I get an error

ERROR: Could not find a version that satisfies the requirement utilities_x_ray
ERROR: No matching distribution found for utilities_x_ray
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-14-79d7808e32c5> in <module>
 11 import matplotlib.pyplot as plt
 12 get_ipython().system('pip install utilities_x_ray')
---> 13 import utilities_x_ray
 14 from utilities_x_ray import read_xray,showXray
 15 from tqdm import tqdm

ModuleNotFoundError: No module named 'utilities_x_ray'
question from:https://stackoverflow.com/questions/65892979/import-own-python-module-on-kaggle

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You do not need to pip install the utility file. Rather, just include the utilities_x_ray.py file in the same directory that you run the python notebook.

The python notebook looks for files within the same directory whenever importing as well as those modules that were installed via pip.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...