Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Install fastai
#1
I am trying to install fastai on Ubuntu 16.04. I have Python 3.5.2 The default Python 3 used on Ubuntu 16.04. I know that fastai requirees Python 3.6 or greater or it will simply not install. I have installed python 3.6.6 on Ubuntu 16.04 and it works.

I am using the guidleines shown at the following link for installing fastai:

https://medium.com/@chrisfotache/getting...2386952d03

It fails on the command:

pip install fastai

The output is now shown when I get th error.

Requirement already satisfied: numpy in
/home/james/.local/lib/python3.5/site-packages (from fastai) (1.16.0)
Requirement already satisfied: torchvision in
/usr/local/lib/python3.5/dist-packages (from fastai) (0.2.2.post3)
Requirement already satisfied: pyparsing in
/home/james/.local/lib/python3.5/site-packages (from fastai) (2.3.1)
Requirement already satisfied: MarkupSafe in
/usr/lib/python3/dist-packages (from fastai) (0.23)
Requirement already satisfied: pytz in
/home/james/.local/lib/python3.5/site-packages (from fastai) (2018.9)
Requirement already satisfied: webencodings in
/home/james/.local/lib/python3.5/site-packages (from fastai) (0.5.1)
Requirement already satisfied: html5lib in
/usr/lib/python3/dist-packages (from fastai) (0.999)
Requirement already satisfied: cycler in
/home/james/.local/lib/python3.5/site-packages (from fastai) (0.10.0)
Requirement already satisfied: scipy in
/home/james/.local/lib/python3.5/site-packages (from fastai) (1.2.0)
Collecting simplegeneric (from fastai)
  Using cached https://files.pythonhosted.org/packages/3d/57/4d9c9e3ae9a255cd4e1106bb57e24056d3d0709fc01b2e3e345898e49d5b/simplegeneric-0.8.1.zip
Collecting isoweek (from fastai)
  Using cached https://files.pythonhosted.org/packages/c2/d4/fe7e2637975c476734fcbf53776e650a29680194eb0dd21dbdc020ca92de/isoweek-1.3.3-py2.py3-none-any.whl
Collecting bcolz (from fastai)
  Using cached https://files.pythonhosted.org/packages/5c/4e/23942de9d5c0fb16f10335fa83e52b431bcb8c0d4a8419c9ac206268c279/bcolz-1.2.1.tar.gz
    Complete output from command python setup.py egg_info:
    SSE2 detected
    AVX2 detected
    running egg_info
    creating pip-egg-info/bcolz.egg-info
    writing requirements to pip-egg-info/bcolz.egg-info/requires.txt
    writing top-level names to pip-egg-info/bcolz.egg-info/top_level.txt
    writing pip-egg-info/bcolz.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/bcolz.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/bcolz.egg-info/SOURCES.txt'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-04noh681/bcolz/setup.py", line 234, in <module>
        cmdclass=LazyCommandClass(),
      File "/usr/local/lib/python3.5/dist-packages/setuptools/__init__.py",
line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.5/dist-packages/setuptools/command/egg_info.py",
line 296, in run
        self.find_sources()
      File "/usr/local/lib/python3.5/dist-packages/setuptools/command/egg_info.py",
line 303, in find_sources
        mm.run()
      File "/usr/local/lib/python3.5/dist-packages/setuptools/command/egg_info.py",
line 534, in run
        self.add_defaults()
      File "/usr/local/lib/python3.5/dist-packages/setuptools/command/egg_info.py",
line 570, in add_defaults
        sdist.add_defaults(self)
      File "/usr/local/lib/python3.5/dist-packages/setuptools/command/py36compat.py",
line 36, in add_defaults
        self._add_defaults_ext()
      File "/usr/local/lib/python3.5/dist-packages/setuptools/command/py36compat.py",
line 119, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/usr/lib/python3.5/distutils/cmd.py", line 298, in
get_finalized_command
        cmd_obj = self.distribution.get_command_obj(command, create)
      File "/usr/lib/python3.5/distutils/dist.py", line 846, in get_command_obj
        klass = self.get_command_class(command)
      File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py",
line 840, in get_command_class
        return self.cmdclass[command]
      File "/tmp/pip-install-04noh681/bcolz/setup.py", line 56, in __getitem__
        class build_ext(cython_build_ext):
    TypeError: module.__init__() takes at most 2 arguments (3 given)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
/tmp/pip-install-04noh681/bcolz/
Now as you can see it is using Python 3.5.2 to install fastai. That is wrong. How can I make it use Python 3.6.6 instead and not fail. I have both on my hard drive.

Thanks in advance.

Respectfully,

ErnestTBass
Reply
#2
Try this:
python3.6 -m pip install fastai
Reply
#3
Okay, that worked. Now run the following command in Python3.6

from fastai.structured import datepart

That line fails see code below for output. I googled the error and it did claim that fastai.structured
was removed from fastai. So installing fastai will not help here. The google message says that it is not in fastai
anymore as of earlier this year .

Now all I need o knw is where is it?

ython 3.6.7 (default, Oct 25 2018, 09:16:13)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fastai
>>> from fastai.structured import add_datepart
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'fastai.structured'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line
63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23,
in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line
23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'fastai.structured'
>>>
Reply
#4
Here it's working.
Which version did pip install?

python3.6 -m pip list | grep fastai

Mine is 0.7.0, to force pip install it:

python3.6 -m pip install fastai==0.7.0
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020