0

The problem started when I wanted to install pyinstaller using pip and got the error below.

ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python/bin/python3.7 /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/vv/cwv95ck53677_nsc37m749000000gn/T/pip-build-env-sdsbi36x/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
       cwd: None
  Complete output (36 lines):
  Traceback (most recent call last):
    File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
      "__main__", mod_spec)
    File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
      exec(code, run_globals)
    File "/usr/local/lib/python3.7/site-packages/pip/__main__.py", line 16, in <module>
      from pip._internal.main import main as _main  # isort:skip # noqa
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/main.py", line 13, in <module>
      from pip._internal.cli.autocompletion import autocomplete
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 11, in <module>
      from pip._internal.cli.main_parser import create_main_parser
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
      from pip._internal.cli import cmdoptions
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 25, in <module>
      from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/locations.py", line 18, in <module>
      from pip._internal.utils import appdirs
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/utils/appdirs.py", line 16, in <module>
      from pip._internal.utils.compat import WINDOWS, expanduser
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/utils/compat.py", line 17, in <module>
      from pip._vendor.urllib3.util import IS_PYOPENSSL
    File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/__init__.py", line 7, in <module>
      from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
    File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 11, in <module>
      from .exceptions import (
    File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/exceptions.py", line 2, in <module>
      from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
    File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/six.py", line 199, in load_module
      mod = mod._resolve()
    File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/six.py", line 113, in _resolve
      return _import_module(self.mod)
    File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/six.py", line 82, in _import_module
      __import__(name)
    File "/usr/local/lib/python3.7/site-packages/http/__init__.py", line 7, in <module>
      raise ImportError('This package should not be accessible on Python 3. '
  ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python/bin/python3.7 /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/vv/cwv95ck53677_nsc37m749000000gn/T/pip-build-env-sdsbi36x/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.

I tried googling the error to find a solution and I tried a suggestion of unset $PYTHONPATH and then I tried reinstalling python as a whole using brew and then tried installing pyinstaller again at which point I got the error message below and now get this message when I try installing anything using pip or running any python program. Also I am running MacOS Catalina 10.15.2.

$ python3 main.py

Error processing line 1 of /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/backports.csv-1.0.6-py3.6-nspkg.pth:

Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py", line 168, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/util.py", line 14, in <module>
    from contextlib import contextmanager
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 5, in <module>
    from collections import deque
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/collections/__init__.py", line 27, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/usr/local/lib/python3.7/site-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py", line 579, in <module>
    main()
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py", line 566, in main
    known_paths = addsitepackages(known_paths)
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py", line 349, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py", line 207, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py", line 178, in addpackage
    import traceback
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/traceback.py", line 3, in <module>
    import collections
  File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/collections/__init__.py", line 27, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/usr/local/lib/python3.7/site-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

$ python3 --version

Python 3.7.5

If anyone can help, I would be very grateful. Thank you!


UPDATE

Upon view this question, I have decided to reinstall my OS. Thank you to those who responded which helped me refine my search and find these question.

Carlton
  • 1
  • 1
  • looks a bit like you have multiple versions of python installed, and they are looking in the wrong place for libraries. The specific error is from trying to import `_thread` (the compiled c library that backs `threading`) which is definitely going to be picky about running with the correct python executable. – Aaron Dec 20 '19 at 18:26

1 Answers1

0

A few suggestions (after you wipe your python from your system again):

  • Try installing the development version of pyinstaller in case it's a bug with them: pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
  • Forget about pip and install anaconda. Anaconda is a package manager for handling versioning and dependencies. Versioning and dependencies is the problem you are having here.

Another note: there are probably multiple versions of python on your system. I see you are running python3 there. Were you also running pip3? Make sure these are coming from the same path... do which python 3 and which pip3. Also you can find all installations of python: How to find all python installations on mac os x and uninstall all but the native OS X installation and remove them or at least make sure you aren't inadvertently using them.

MaMaG
  • 359
  • 1
  • 9
  • I get an error when trying to install the development version: `Error in sitecustomize; set PYTHONVERBOSE for traceback: ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.` Additionally, pip3 and python3 are located in `usr/local/bin`. Is anaconda an alternative to pip? – Carlton Dec 20 '19 at 17:05
  • Okay, I am able to run my programs after running `unset PYTHONPATH` again, however still unable to install pyinstaller and I was able to reproduce the error I got before when trying to install it. I have added it to the description above. – Carlton Dec 20 '19 at 17:16