Trying to run fastai library under virtualenv, hit bcolz error


(Traun Leyden) #1

I tried running fastai under python3 + virtualenv (as opposed to Anaconda), however I ran into errors trying to import bcolz.

I documented the error on the bcolz repo:

But I’m wondering if anyone here knows of a workaround? Or should I just use Anaconda?


ModuleNotFoundError: No module named 'dataclasses'
#2

Yes you should install anaconda - why wouldn’t you? Either way install numpy before bcolz in a separate pip/conda install. I recall one of the bcolz dependencies is specified as xxx>=3.2. Hence if xxx is not installed it installs latest version which is not compatible with numpy.


#3

In case it helps someone else:

I also ran into issues related to installing/building bcolz.

For me, the fix was to install the python-dev library.

# python2.7
$ sudo apt install python-dev
# python3
$ sudo apt install python3-dev
# python3.6
$ sudo apt install python3.6-dev

Then I could painlessly install fastai:

$ pipenv install fastai

I would highly recommend checking out pipenv as a modern alternative to conda, plus I believe pipenv is now actually maintained by PyPA. Besides automatically creating and switching virtual environments for you, pipenv also provides a more mature requirements management and “locking” system similar to npm — including python version requirements — and is probably a little more portable (I never had success using conda’s environment.yml across 2 different machines), though you may need to rm Pipfile.lock; pipenv install on a different system, due to the system-specific nature of python dependencies. :+1:


(Avi A) #4

Collin,

I’m trying to install fastai using pipenv and I’m getting the same timeout error reported here:

pipenv.patched.notpip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

I have no problem installing fastai on a regular venv. I’m using OSX but can you provide some hints on where to go?

Thanks