tenacity icon indicating copy to clipboard operation
tenacity copied to clipboard

Setup.py missing the package name

Open heyglen opened this issue 5 years ago • 6 comments

The setup.py has no package name, so installing from a downloaded .tar.gz results in the following:

pip install tenacity-6.0.0.tar.gz
Processing ./tenacity-6.0.0.tar.gz
Building wheels for collected packages: UNKNOWN
  Building wheel for UNKNOWN (setup.py) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-6.0.0-py2.py3-none-any.whl size=5115 sha256=b70bc9e63c8a3ce17fba2580905b884eac7eb889d9692ca092ac016149c25e1f
  Stored in directory: /....
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
  Found existing installation: UNKNOWN 6.0.0
    Uninstalling UNKNOWN-6.0.0:
      Successfully uninstalled UNKNOWN-6.0.0
Successfully installed UNKNOWN-6.0.0

You can add the name to fix:

setuptools.setup(
    name='tenacity',
    setup_requires=['setuptools_scm'],
    use_scm_version=True,
)

heyglen avatar Nov 14 '19 12:11 heyglen

This name is in setup.cfg. Isn't your setuptools able to read it?

jd avatar Nov 14 '19 13:11 jd

Environment

  • OS: RedHat 7.6 (no internet access)
  • Python: 3.6.8
  • Pip: 19.3.1
  • Tenacity: 6.0.0
  • setuptools_scm: 3.3.3

Reproduce


$ virtualenv-3 /home/user/virtualenv/test -p python3.6 --clear
$ source /home/user/virtualenv/test/bin/activate

# Install the dependency
(test) $ pip install pip-19.3.1.tar.gz --no-index
#...
(test) $ pip install setuptools_scm-3.3.3.tar.gz --no-index
# ...

# Install tenacity
(test) $ pip install -U tenacity-6.0.0.tar.gz --no-index
Processing ./tenacity-6.0.0.tar.gz
Building wheels for collected packages: UNKNOWN
  Building wheel for UNKNOWN (setup.py) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-6.0.0-py2.py3-none-any.whl size=1565 sha256=64862db5ad8d52cd0f89beabea39723c2c6a3cee47ebfa492ca3280de000366b
  Stored in directory: /home/user/.cache/pip/wheels/36/c4/04/c2141b2ebc79a9ce4c392e93d4d1b1a34f5cbf1ddb2372f2a6
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
Successfully installed UNKNOWN-6.0.0

(test) $ pip uninstall UNKNOWN
#...

# Patch tenacity
(test) $ tar xvf tenacity-6.0.0.tar.gz
(test) $ mv tenacity-6.0.0 tenacity-6.0.1
(test) $ vim tenacity-6.0.1/setup.py
# Add `name='tenacity',` to the `setuptools.setup()` parameters
(test) $ tar -czvf tenacity-6.0.1.tar.gz tenacity-6.0.1/

# Try again
(test) $ pip install tenacity-6.0.1.tar.gz --no-index
Processing ./tenacity-6.0.1.tar.gz
Building wheels for collected packages: tenacity
  Building wheel for tenacity (setup.py) ... done
  Created wheel for tenacity: filename=tenacity-6.0.0-py2.py3-none-any.whl size=1595 sha256=64c31895baa46ba62a9920a860195f0545a9ae99b270d367fd369187723fae54
  Stored in directory: /home/user/.cache/pip/wheels/a8/11/fa/a6ad89dc232a675ad3f3e6b78f8164ada135f10bff3f81b67f
Successfully built tenacity
Installing collected packages: tenacity
Successfully installed tenacity-6.0.0

heyglen avatar Nov 15 '19 09:11 heyglen

I'm unable to reproduce here, weird:

➔ python3 -m venv venvtest
➔ venvtest/bin/pip install ~/Downloads/tenacity-6.0.0.tar.gz
Processing /Users/jd/Downloads/tenacity-6.0.0.tar.gz
Collecting six>=1.9.0 (from tenacity==6.0.0)
  Using cached https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl
Installing collected packages: six, tenacity
  Running setup.py install for tenacity ... done
Successfully installed six-1.13.0 tenacity-6.0.0
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I'm also surprised your pip install tries to build a wheel?

jd avatar Nov 15 '19 13:11 jd

What system did you try to reproduce on?

Avoiding a pip deep dive to find the root cause, would it hurt anything to just add the name to the setup.py file?

heyglen avatar Nov 18 '19 07:11 heyglen

This is just a standard Python 3 from homebrew (MacOS). Not a big deal I guess to add it, I'm more afraid of what it means that it does not work. Is there any other field that it's not reading? Is something bigger that does not work in the end that is going to bite us later?

jd avatar Nov 18 '19 22:11 jd

Your worries are well founded. I did some more testing after installing the patch I described above.

TLDR; Pip on Linux says all is good, but the install does not work. Issue appears to be with pip

# After patching setup.py with `name='tenacity',`
(test) $ pip freeze | grep tenacity
tenacity==6.0.0
(test) $ which python
~/virtualenv/test/bin/python
(test) $ python
Python 3.6.8 (default, Apr 25 2019, 21:02:35)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tenacity
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tenacity'

# What was installed

(test) $ python
Python 3.6.8 (default, Apr 25 2019, 21:02:35)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for path in sys.path:
...     print(path)
...

/home/user/virtualenv/test/lib64/python36.zip
/home/user/virtualenv/test/lib64/python3.6
/home/user/virtualenv/test/lib64/python3.6/lib-dynload
/usr/lib64/python3.6
/usr/lib/python3.6
/home/user/virtualenv/test/lib/python3.6/site-packages
>>> exit()

(test) $ ls -l /home/user/virtualenv/test/lib/python3.6/site-packages | grep tenacity
drwxr-xr-x 2 user domain users  131 Nov 19 10:28 tenacity-6.0.0.dist-info

# For reference, this is what the tenacity install looks like on my Win10 PC:
# dir C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\ | findstr tenacity
# 15-11-2019  10:12    <DIR>          tenacity
# 15-11-2019  10:12    <DIR>          tenacity-6.0.0-py3.6.egg-info

# The "tenacity" directory is missing from the Linux install

# Lets try some more stuff on the Linux box:
# Try installing by name instead of the zip package
(test) $ pip uninstall tenacity
(test) $ pip install tenacity --no-index --find-links .
Looking in links: .
Processing /home/user/.cache/pip/wheels/a8/11/fa/a6ad89dc232a675ad3f3e6b78f8164ada135f10bff3f81b67f/tenacity-6.0.0-py2.py3-none-any.whl
Installing collected packages: tenacity
Successfully installed tenacity-6.0.0
(test) $ l /home/user/virtualenv/test/lib/python3.6/site-packages | grep tenacity
drwxr-xr-x 2 user domain users  131 Nov 19  2019 tenacity-6.0.0.dist-info
(test) $ pip freeze
setuptools-scm==3.3.3
tenacity==6.0.0
(test) $ ls -l /home/user/virtualenv/test/lib/python3.6/site-packages | grep tenacity
drwxr-xr-x 2 user domain users  131 Nov 19 10:39 tenacity-6.0.0.dist-info
(test) $ python
Python 3.6.8 (default, Apr 25 2019, 21:02:35)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tenacity
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tenacity'
>>> import importlib
>>> tenacity = importlib.import_module('tenacity')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/virtualenv/test/lib64/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 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tenacity'
>>> tenacity = importlib.import_module('tenacity-6.0.0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/virtualenv/test/lib64/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 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tenacity-6'
>>> tenacity = importlib.import_module('tenacity-6.0.0.dist-info')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/virtualenv/test/lib64/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 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tenacity-6'
>>> exit()

# Install the patched tenacity from source instead of a wheel
(test) $ pip uninstall tenacity
(test) $ pip install tenacity-6.0.1.tar.gz  --no-binary :all:
Processing ./tenacity-6.0.1.tar.gz
Skipping wheel build for tenacity, due to binaries being disabled for it.
Installing collected packages: tenacity
    Running setup.py install for tenacity ... done
Successfully installed tenacity-6.0.0
(test) $ python
Python 3.6.8 (default, Apr 25 2019, 21:02:35)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tenacity
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tenacity'

heyglen avatar Nov 19 '19 11:11 heyglen