[pip] ModuleNotFoundError: No module named 'Cython'


#1

Hi.

I am using “neptune send” with keys --environment pytorch-0.4.0-gpu-py3 --worker xs-k80 --pip-requirements-file requirements.txt

Content of requirements.txt:
neptune_cli
steppy
steppy-toolkit
bokeh
flask
numpy
opencv_python
attrdict==2.0.0
category_encoders==1.2.8
click==6.7
contextlib2==0.5.5
imgaug==0.2.6
pandas==0.20.2
Pillow==5.2.0
protobuf==3.6.0
Cython
pycocotools==2.0.0
PyYAML==3.13
scikit_learn==0.19.2
six==1.10.0
tensorflow==1.6.0
torch==0.3.1
torchvision==0.2.1
tqdm==4.11.2

I got the following error:

10.933109 [pip] Downloading https://files.pythonhosted.org/packages/96/84/9a07b1095fd8555ba3f3d519517c8743c2554a245f9476e5e39869f948d2/pycocotools-2.0.0.tar.gz (1.5MB)
10.933236 [pip] Complete output from command python setup.py egg_info:
10.933397 [pip] Traceback (most recent call last):
10.933516 [pip] File “”, line 1, in
10.933629 [pip] File “/tmp/pip-install-htb3y2t0/pycocotools/setup.py”, line 2, in
10.933774 [pip] from Cython.Build import cythonize
10.933885 [pip] ModuleNotFoundError: No module named ‘Cython’
10.934006 [pip]
10.934164 [pip] ----------------------------------------

#2

Hi,

I did some testing, and it appears that your installation fails, because pycocotools require Cython to be already installed before it can be unpacked by pip

It installes correctly if you run two separate pip commands:

pip install Cython
pip install -r requirements.txt

You can work around this issue by running your code like a notebook (Docs), and then running two cells:
!pip install Cython
!pip install -r requirements.txt
And then running your code in third cell

Note, that if you are using notebook, you should not create Neptune context in your code, it is already available in ctx variable

I also noticed you are using pytorch-0.4.0-gpu-py3 environment and installing a lot of libraries.

It might be easier for you to use pytorch-0.3.0-gpu-py3 environment. Here is an output of pip freeze from that environemnt:

absl-py==0.3.0
argcomplete==1.9.4
astor==0.7.1
atari-py==0.1.1
backcall==0.1.0
bleach==2.1.3
Box2D-kengz==2.3.3
certifi==2018.4.16
chainer==4.3.0
chardet==3.0.4
click==6.7
cloudpickle==0.5.3
cupy-cuda90==4.3.0
cycler==0.10.0
cymem==1.31.2
cytoolz==0.9.0.1
dask==0.18.2
decorator==4.3.0
dill==0.2.8.2
dlib==19.15.0
docopt==0.6.2
entrypoints==0.2.3
enum34==1.1.6
fastrlock==0.3
filelock==3.0.4
Flask==0.12
future==0.16.0
gast==0.2.0
gitdb2==2.0.4
GitPython==2.1.11
grpcio==1.13.0
gym==0.10.5
h5py==2.8.0
html5lib==1.0.1
humanize==0.5.1
idna==2.7
imageio==2.3.0
ipykernel==4.8.2
ipython==6.4.0
ipython-genutils==0.2.0
ipywidgets==7.3.0
itsdangerous==0.24
jedi==0.12.1
Jinja2==2.10
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.2.3
jupyter-console==5.2.0
jupyter-core==4.4.0
Keras==2.2.0
Keras-Applications==1.0.2
Keras-Preprocessing==1.0.1
kitchen==1.2.5
kiwisolver==1.0.1
Markdown==2.6.11
MarkupSafe==1.0
matplotlib==2.2.2
mistune==0.8.3
more-itertools==4.2.0
mpmath==1.0.0
msgpack==0.5.6
msgpack-numpy==0.4.3.1
mujoco-py==0.5.7
murmurhash==0.28.0
nbconvert==5.3.1
nbformat==4.4.0
neptune-cli==2.8.7
neptune-contents-manager==0.1
networkx==2.1
nltk==3.3
notebook==5.6.0
numpy==1.15.0
oauthlib==2.1.0
opencv-python==3.4.2.17
pandas==0.23.3
pandocfilters==1.4.2
parso==0.3.1
pathlib2==2.3.0
pexpect==4.6.0
pickleshare==0.7.4
Pillow==5.2.0
plac==0.9.6
preshed==1.0.1
prometheus-client==0.3.0
prompt-toolkit==1.0.15
protobuf==3.6.0
psutil==5.4.6
ptyprocess==0.6.0
pycurl==7.43.0
pyglet==1.3.2
Pygments==2.2.0
pygobject==3.20.0
PyJWT==1.6.4
pykwalify==1.5.2
PyOpenGL==3.1.0
pyparsing==2.2.0
python-apt==1.1.0b1+ubuntu0.16.4.2
python-dateutil==2.7.3
pytz==2018.5
PyWavelets==0.5.2
PyYAML==3.13
pyzmq==17.1.0
qtconsole==4.3.1
raven==6.9.0
regex==2017.4.5
requests==2.19.1
requests-oauthlib==1.0.0
scikit-image==0.14.0
scikit-learn==0.19.2
scipy==1.1.0
Send2Trash==1.5.0
simplegeneric==0.8.1
six==1.11.0
sklearn==0.0
smmap2==2.0.4
spacy==2.0.12
sympy==1.2
tensorboard==1.9.0
tensorflow-gpu==1.9.0
termcolor==1.1.0
terminado==0.8.1
terminaltables==2.1.0
testpath==0.3.1
Theano==0.9.0
thinc==6.10.3
toolz==0.9.0
torch==0.3.1
torchvision==0.2.1
tornado==5.1
tqdm==4.23.4
traitlets==4.3.2
ujson==1.35
unattended-upgrades==0.1
urllib3==1.23
virtualenv==16.0.0
voluptuous==0.11.1
wcwidth==0.1.7
webencodings==0.5.1
websocket-client==0.48.0
Werkzeug==0.14.1
widgetsnbextension==3.3.0
wrapt==1.10.11
xgboost==0.72.1

#3

Hi,

We added Cython to all our environmnets, you should no longer have this issue

Hope it helps :slight_smile: ,
Hubert