简体   繁体   中英

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'

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 .

You need to copy the script content from https://www.kaggle.com/bibhash123/utilities-x-ray into your working directory and save it as utilities_x_ray.py Hope this w'll be helpfull

You should consider downloading both the chest-x-ray-abnormalities-baseline-tf-keras.ipynb as在此处输入图像描述 and the utilities_x_ray.py 在此处输入图像描述 Please make sure that they are into the same folder... After that, you'll need to install the pydimcom and scikit-image using pip install pydicom scikit-image

You can also install the packages directly from the GIt repository:

:pip install git+https.//github.com/dkriegner/xrayutilities.git

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM