Developer chat

@elmarculino, I have just followed your steps plus:

pip install jupyter_contrib_nbextensions ipywidgets

and loading pytorch works for me from the jupyter notebook.

Perhaps print your sys.path and see whether you’re using the wrong environment when you run jupyter notebook?

You are right. The path was wrong.

From notebook, using jupyter lab, i got the error ModuleNotFoundError: No module named ‘torch’:

['',
 '/home/marco/anaconda3/lib/python36.zip',
 '/home/marco/anaconda3/lib/python3.6',
 '/home/marco/anaconda3/lib/python3.6/lib-dynload',
 '/home/marco/anaconda3/lib/python3.6/site-packages',
 '/mnt/ssd32gb/Arquivos/MachineLearning/fastai_pytorch',
 '/home/marco/anaconda3/lib/python3.6/site-packages/IPython/extensions',
 '/home/marco/.ipython']

From notebook, using jupyter notebook:

['',
 '/mnt/ssd32gb/Arquivos/MachineLearning/fastai-repo/examples',
 '/home/marco/anaconda3/envs/fastai_v1/lib/python37.zip',
 '/home/marco/anaconda3/envs/fastai_v1/lib/python3.7',
 '/home/marco/anaconda3/envs/fastai_v1/lib/python3.7/lib-dynload',
 '/home/marco/anaconda3/envs/fastai_v1/lib/python3.7/site-packages',
 '/mnt/ssd32gb/Arquivos/MachineLearning/fastai-repo',
 '/home/marco/anaconda3/envs/fastai_v1/lib/python3.7/site-packages/IPython/extensions',
 '/home/marco/.ipython']

Here the kernel always restarts:

[W 01:19:16.595 NotebookApp] Notebook fastai-repo/examples/cifar.ipynb is not trusted
[I 01:19:17.113 NotebookApp] Kernel started: ed9289cd-5b3c-4acc-86fd-5e702248e09e
[I 01:19:17.681 NotebookApp] Adapting to protocol v5.1 for kernel ed9289cd-5b3c-4acc-86fd-5e702248e09e
[I 01:19:32.109 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel ed9289cd-5b3c-4acc-86fd-5e702248e09e restarted
[I 01:20:05.127 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel ed9289cd-5b3c-4acc-86fd-5e702248e09e restarted

Python console:

>>> sys.path
['', 
'/home/marco/anaconda3/envs/fastai_v1/lib/python37.zip', 
'/home/marco/anaconda3/envs/fastai_v1/lib/python3.7', 
'/home/marco/anaconda3/envs/fastai_v1/lib/python3.7/lib-dynload', 
'/home/marco/anaconda3/envs/fastai_v1/lib/python3.7/site-packages', 
'/mnt/ssd32gb/Arquivos/MachineLearning/fastai-repo']

I will reinstall my anaconda and try again. Thanks for your help!

Look exactly like the messages i got on Windows 10 / WSL. I abononned it:(

I was able to reproduce your problem.

You need to:

conda install jupyter

will update the docs/deps

That made the notebook get the right path.

The jupyterlab package was installed in the conda root environment. After I install the package in the fastai_v1 env the path changed to the right one.

Even after this install, the kernel is still restarting. The –debug flag did not helped to find what is causing that.
Do you know other way to debug this?

update: I made a new release: fastai-1.0.3 which includes this dependency.

If you could kindly re-run the complete install from scratch and the newly made (again) environment and report results that would be very helpful:

conda create -y  --name fastai_v3
conda activate fastai_v3
conda install -y -c pytorch -c fastai fastai pytorch-nightly cuda92
conda uninstall -y fastai
pip install -e .

Can you try the complete rebuild and test it in jupyter notebook environment first? I have just tested it to work as I instructed above.

I haven’t yet tried jupyterlab, perhaps someone else did… I’d imagine you need some other packages installed?

The kernel is still restarting every time I import fastai.

I got this error on pip install -e .

https://pastebin.com/MbnnHFpm

That is the restarting log:

[I 03:04:09.207 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:root:kernel ec8fe490-05d7-4dbc-8803-ef553727ab4c restarted
[D 03:04:09.210 NotebookApp] Starting kernel: ['/home/marco/anaconda3/envs/fastai_v3/bin/python', '-m', 'ipykernel_launcher', '-f', '/run/user/1000/jupyter/kernel-ec8fe490-05d7-4dbc-8803-ef553727ab4c.json']
[D 03:04:09.223 NotebookApp] Connecting to: tcp://127.0.0.1:39013
[D 03:04:09.774 NotebookApp] activity on ec8fe490-05d7-4dbc-8803-ef553727ab4c: status
[D 03:04:09.825 NotebookApp] activity on ec8fe490-05d7-4dbc-8803-ef553727ab4c: status
[D 03:04:09.829 NotebookApp] activity on ec8fe490-05d7-4dbc-8803-ef553727ab4c: status
[D 03:04:10.045 NotebookApp] 304 GET /static/base/images/favicon-notebook.ico (127.0.0.1) 3.57ms
[D 03:04:12.226 NotebookApp] KernelRestarter: restart apparently succeeded
[D 03:04:12.478 NotebookApp] activity on ec8fe490-05d7-4dbc-8803-ef553727ab4c: status
[D 03:04:12.485 NotebookApp] activity on ec8fe490-05d7-4dbc-8803-ef553727ab4c: execute_input
[D 03:04:13.659 NotebookApp] 304 GET /static/base/images/favicon-busy-1.ico (127.0.0.1) 1.52ms
$ pipdeptree --reverse --packages regex
Warning!!! Possibly conflicting dependencies found:
* tensorflow==1.9.0
 - setuptools [required: <=39.1.0, installed: 40.2.0]
* jupyter==1.0.0
 - ipywidgets [required: Any, installed: ?]
* fastai==1.0.3
 - fastprogress [required: >=0.1.9, installed: 0.1.8]
------------------------------------------------------------------------
regex==2017.4.5
  - spacy==2.0.12 [requires: regex==2017.4.5]
    - en-core-web-sm==2.0.0 [requires: spacy>=2.0.0a18]
    - fastai==1.0.3 [requires: spacy]
    - fr-core-news-sm==2.0.0 [requires: spacy>=2.0.0a19]

spacy needs regex.

Install:

$ pip install pipdeptree

what do you get for?

$ pipdeptree --reverse --packages regex

You did follow the exact steps from here, correct?

Both space and regex should have been installed by conda then. why would pip try to install them again?

Also it suggests ipywidgets aren’t installed, but it’s there.

I think pipdeptree is glitchy.

Warning!!! Possibly conflicting dependencies found:
* Twisted==18.7.0
 - PyHamcrest [required: >=1.9.0, installed: ?]
* spacy==2.0.12
 - regex [required: ==2017.4.5, installed: 2018.7.11]
* mkl-random==1.0.1
 - cython [required: Any, installed: ?]
------------------------------------------------------------------------
regex==2018.7.11
  - spacy==2.0.12 [requires: regex==2017.4.5]
    - fastai==1.0.3 [requires: spacy]

conda list:

https://pastebin.com/ywiWrn7x

Please try the two suggestions here

But try the second first. And then the first.

Let me know which if any worked.

Both failed,

https://pastebin.com/91t22y03

Thank you,

I figured it out, you are on python 3.7, and there is no wheel for regex==2017.4.5 for python 3.7. only the newer 2018 versions have python 3.7 build.

While I only see 2018 wheels here https://pypi.org/project/regex/#files. You can see all of them here: https://pypi.org/simple/regex/

So if you are not attached to python3.7, use 3.6 and it will just work, since there is a wheel for that.

 conda create -y  python=3.6 --name fastai_xxx

If however you want python 3.7, you will need to figure the build from source. Probably some dev packages missing.

Let us know whether this resolved it?

Otherwise somebody who knows spacy will need to step in to figure out its dependency on regex==2017.4.5 - why can’t we have 2018 ed?.

FYI, my system builds regex==2017.4.5 wtih python 3.7 just fine:

pip install spacy
Building wheels for collected packages: regex
  Running setup.py bdist_wheel for regex ... done
  Stored in directory: /home/stas/.cache/pip/wheels/75/07/38/3c16b529d50cb4e0cd3dbc7b75cece8a09c132692c74450b01
Successfully built regex

Your compiler env is incomplete, try this

If that wasn’t it, It’s hard for me to search for the exact solution since your gcc error output is not in english, but explore google results with: “/usr/lib/gcc/” “include-fixed/limits.h” “no such” and probably your linux distro. and install whatever build/make tools you’re missing.

The g++ package was already installed.

I got the same errors with python 3.6:

https://pastebin.com/7L5u0SvW

I will try again tomorrow. Thanks for your help.

1 Like

wrt 3.6, you’re correct, I didn’t pay close attention. All the wheels are built for the windows platform - none for linux.

So basically unless you have a healthy build environment on linux you won’t be able to build regex not on py3.6 nor py3.7, and the regex year edition doesn’t matter.

Bottom line: using pip install setup - if a user needs spacy, she needs to be able to build regex from source (via pip install)

But since conda has the binary packages, we just need to figure out why after installing them via conda install you got this issue triggered by pip install -e ..

So I would start from the beginning and carefully try to see where things go astray. Perhaps you can post the complete output of that run somewhere on paste.

Unfortunately, I will be mostly out tomorrow, so unless someone else will have an insight beforehand, I will be most likely have time to dig more into it on Wed.

@stas sorry for the delayed report. I am using miniconda if that helps. I created a new environment (python 3.7).I am not sure why it needed conda install conda but that is the command I used. I am guessing for some reason the new channels were not updated, doing conda install conda did the trick and updated the channels.

Trying to discover what is causing the kernel to restart in my conda environment, I executed each one of these lines in the python console:

from fastai import *
from fastai.vision import *
from fastai.collab import *
from fastai.tabular import *
from fastai.text import *
from fastai.docs import *

Every one of them stopped in the following lines:

# code object from '/home/marco/anaconda3/envs/fastai/lib/python3.6/site-packages/fastai/vision/__pycache__/transform.cpython-36.pyc'
import 'fastai.vision.transform' # <_frozen_importlib_external.SourceFileLoader object at 0x7fd88eb5f2b0>

Is the ‘fastai.vision.transform’ been imported with collab, tabular, text or docs too?

To maintain the conda packages and not install the pip ones I did:

pip install -e . --no-dependencies

The spacy package is working fine and I can import fastai from the repository folder (until the kernel restarts, as described above).

Currently building a v2.0.13.dev3 of spaCy with the updated regex version. The exact pin was unfortunate, but regex doesn’t semver, making it hard to give a range :(. The dev version should be uploaded within the next half hour or so (CI can take some time).

Once it’s up, you should be able to set your version pin to spacy==2.0.13.dev3 to verify that it all works. I can then publish 2.0.13 properly, so you can set your pin to spacy>=2.0.13,<2.1.0

Edit: Getting test failures with regex==2018.08.29; some of the tests are simply hanging. I guess I can try some earlier versions, but it makes me nervous about rushing out a version on this. I’m worried performance could be much worse on some inputs, for some languages.

3 Likes

Please note a minor change in dev install steps

In addition to having all pip dependencies managed in a single file (setup.py),

To do an editable install, do:

pip install -e .[dev]

It’s almost the same as:

pip install -e .

but the former will also install extra dependencies needed only by developers. Of course, the latter works as before…

Down the road we can define a whole bunch of sub-project dependencies (e.g. just NLP-related deps) and install them with:

pip install -e .[nlp]
1 Like