Anakin Skywalker
Anakin Skywalker

Reputation: 2520

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'

Upvotes: 1

Views: 3329

Answers (4)

The 5th column mouse
The 5th column mouse

Reputation: 780

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

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

Upvotes: 1

wmsr
wmsr

Reputation: 44

You should consider downloading both the chest-x-ray-abnormalities-baseline-tf-keras.ipynb as enter image description here and the utilities_x_ray.py enter image description here 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

Upvotes: 1

wmsr
wmsr

Reputation: 44

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

Upvotes: 1

rohanphadte
rohanphadte

Reputation: 1018

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.

Upvotes: 1

Related Questions