bonzanini / Book-SocialMediaMiningPython

Companion code for the book "Mastering Social Media Mining with Python"
546 stars 265 forks source link

Fedora 25 gensim pip error #1

Closed ianchanning closed 7 years ago

ianchanning commented 7 years ago

I'm trying to install this on Fedora 25. I have pip3 instead of just pip as both Python 2 and Python 3 are installed by default.

I got the following error when running the pip3 install -r requirements.txt command:

Collecting gensim==0.13.1 (from -r requirements.txt (line 11))
  Downloading gensim-0.13.1.tar.gz (4.2MB)
    100% |████████████████████████████████| 4.2MB 312kB/s 
    Complete output from command python setup.py egg_info:
    non-existing path in 'numpy/distutils': 'site.cfg'
    Could not locate executable gfortran
    Could not locate executable f95
    Could not locate executable ifort
    Could not locate executable ifc
    Could not locate executable lf95
    Could not locate executable pgfortran
    Could not locate executable f90
    Could not locate executable f77
    Could not locate executable fort
    Could not locate executable efort
    Could not locate executable efc
    Could not locate executable g77
    Could not locate executable g95
    Could not locate executable pathf95
    don't know how to compile Fortran code on platform 'posix'
    gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
    Running from numpy source directory.
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/setup.py:366: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/system_info.py:572: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      self.calc_info()
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/system_info.py:572: UserWarning:
        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      self.calc_info()
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/system_info.py:572: UserWarning:
        Blas (http://www.netlib.org/blas/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [blas_src]) or by setting
        the BLAS_SRC environment variable.
      self.calc_info()
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/system_info.py:572: UserWarning:
        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      self.calc_info()
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/system_info.py:572: UserWarning:
        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      self.calc_info()
    /usr/lib64/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 157, in save_modules
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 65, in save_path
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 56, in save_argv
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 83, in override_temp
        yield
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 93, in pushd
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 255, in run_setup
        DirectorySandbox(setup_dir).run(runner)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 285, in run
        return func()
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 253, in runner
        _execfile(setup_script, ns)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 47, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/setup.py", line 391, in <module>
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/setup.py", line 383, in setup_package
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/core.py", line 169, in setup
      File "/usr/lib64/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib64/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/bdist_egg.py", line 152, in run
        self.run_command("egg_info")
      File "/usr/lib64/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/egg_info.py", line 18, in run
      File "/usr/lib64/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 148, in run
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 159, in build_sources
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 294, in build_library_sources
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 377, in generate_sources
      File "numpy/core/setup.py", line 665, in get_mathlib_info
    RuntimeError: Broken toolchain: cannot link a simple C program

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-fib1zbop/gensim/setup.py", line 189, in <module>
        include_package_data=True,
      File "/usr/lib64/python3.5/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/dist.py", line 317, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/dist.py", line 372, in fetch_build_eggs
        replace_conflicting=True,
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 851, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1123, in best_match
        return self.obtain(req, installer)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1135, in obtain
        return installer(requirement)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/dist.py", line 440, in fetch_build_egg
        return cmd.easy_install(req)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 674, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 636, in _tmpdir
        yield str(tmpdir)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 674, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 700, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 881, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 1120, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 1106, in run_setup
        run_setup(setup_script, args)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 258, in run_setup
        raise
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 181, in save_pkg_resources_state
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 169, in save_modules
        saved_exc.resume()
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 144, in resume
        six.reraise(type, exc, self._tb)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 157, in save_modules
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 65, in save_path
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 56, in save_argv
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 83, in override_temp
        yield
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 93, in pushd
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 255, in run_setup
        DirectorySandbox(setup_dir).run(runner)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 285, in run
        return func()
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 253, in runner
        _execfile(setup_script, ns)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 47, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/setup.py", line 391, in <module>
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/setup.py", line 383, in setup_package
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/core.py", line 169, in setup
      File "/usr/lib64/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib64/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/bdist_egg.py", line 152, in run
        self.run_command("egg_info")
      File "/usr/lib64/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/egg_info.py", line 18, in run
      File "/usr/lib64/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 148, in run
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 159, in build_sources
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 294, in build_library_sources
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 377, in generate_sources
      File "numpy/core/setup.py", line 665, in get_mathlib_info
    RuntimeError: Broken toolchain: cannot link a simple C program
    gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-fib1zbop/gensim/
ianchanning commented 7 years ago

It's because gensim has a dependency on numpy and scipy.

I'd always assumed pip resolved dependencies.

Running the commands in this order works fine:

pip3 install numpy==1.11.1
pip3 install scipy==0.18.0
pip3 install gensim==0.13.1
bonzanini commented 7 years ago

@ianchanning thanks for the feedback, yes dependencies are sometimes flakey.

If you can use conda to manage your virtual env, it takes away some of the pain for the pydata stack