spacetelescope / pysynphot

Synthetic Photometry.
http://pysynphot.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
23 stars 21 forks source link

Error in pip3 install #123

Closed paranoya closed 5 years ago

paranoya commented 5 years ago

Hi,

I get the following error when trying to install pysynphot with pip3:

 File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py", line 76, in _build_backend
 obj = getattr(obj, path_part)
 AttributeError: module 'setuptools.build_meta' has no attribute '__legacy__'

¿Could you please provide any help?

Thanks a lot, Yago

This is the full output of the "sudo -H pip3 install pysynphot" command, run under Ubuntu 18.04:

Error initializing plugin EntryPoint('Windows (alt)', 'keyrings.alt.Windows', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/keyring/backend.py", line 190, in _load_plugins
    init_func = ep.load()
  File "/usr/lib/python3/dist-packages/entrypoints.py", line 74, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
    from . import file_base
  File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint('file', 'keyrings.alt.file', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/keyring/backend.py", line 190, in _load_plugins
    init_func = ep.load()
  File "/usr/lib/python3/dist-packages/entrypoints.py", line 74, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/file.py", line 11, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint('pyfs', 'keyrings.alt.pyfs', None, Distribution('keyrings.alt', '3.0')).
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/keyring/backend.py", line 190, in _load_plugins
    init_func = ep.load()
  File "/usr/lib/python3/dist-packages/entrypoints.py", line 74, in load
    mod = import_module(self.module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/pyfs.py", line 8, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Collecting pysynphot
  Using cached https://files.pythonhosted.org/packages/e0/16/2f7ebc3303ef2dc704467c40e104342a7a076e283046b8914ac9b6840862/pysynphot-0.9.14.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp5l_cv1q7
       cwd: /tmp/pip-install-91v7zo1c/pysynphot
  Complete output (10 lines):
  Traceback (most recent call last):
    File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
      main()
    File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py", line 85, in get_requires_for_build_wheel
      backend = _build_backend()
    File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py", line 76, in _build_backend
      obj = getattr(obj, path_part)
  AttributeError: module 'setuptools.build_meta' has no attribute '__legacy__'
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp5l_cv1q7 Check the logs for full command output.
jhunkeler commented 5 years ago

@paranoya Installing software directly into the system's site-package directory could potentially break your OS. Here's a safer way to do this:

Install python3-venv

$ sudo apt-get update
$ sudo apt-get install -y python3-venv

Create a directory for your virtualenv(s)

$ mkdir ~/venvs

Create a new virtualenv

$ python3 -m venv ~/venvs/science
$ source ~/venvs/science/bin/activate

Upgrade setuptools and pip

(science) $ pip install --upgrade pip setuptools

Install pysynphot

(science) $ pip install pysynphot

Please let us know if you're still seeing errors after doing this.

paranoya commented 5 years ago

Upgrading setuptools did indeed solve the problem. I was not aware of the point about Python environments; thanks a lot for both tips!