taurus-org / taurus

Moved to https://gitlab.com/taurus-org/taurus
http://taurus-scada.org
43 stars 46 forks source link

enum34 gets required when installing on debian9 + python 3.5 #984

Closed cpascual closed 5 years ago

cpascual commented 5 years ago

The requirements when installing from a distutils tarball (in this case, this one) in a debian9 with python 3 are wrong (enum34 is considered a requirement when it should not in this environment with python3.5).

This causes all subcommands to fail loading:

root@taurus-test:/# taurus --version
MainThread     WARNING  2019-07-30 10:40:15,674 TaurusRootLogger: Cannot add "guiqwt" subcommand to taurus. Reason: DistributionNotFound(Requirement.parse('enum34'), None)
(...)

The problem occurs because the METADATA file is created with an unconditional requirement for enum34:

root@taurus-test:/# grep enum34 /usr/local/lib/python3.5/dist-packages/taurus-4.6.0a0.dist-info/METADATA
Requires-Dist: enum34

Note that in the dist tarball , the requirements.txt file is correctly stating the conditional requirement:

(...)
[:python_version < "3.4"]
enum34
(...)

And, in fact, using the same tarball within a conda environment results in a correct METADATA file:

(jul19) cpascual@pc218:~/src$ grep enum34 /home/cpascual/miniconda/envs/jul19/lib/python3.6/site-packages/taurus-4.6.0a0.dist-info/METADATA 
Requires-Dist: enum34 ; python_version < "3.4"
cpascual commented 5 years ago

I suspected the pip3 version provided by the system, but upgrading it to pip-19.2.1 (with pip3 install -U pip) and using the new pip to install taurus did not fix it.

But in conda it works, so maybe it is related to setuptools or distutils version...

cpascual commented 5 years ago

I found the culprit: setuptools.

Updating the setuptools shipped in debian9 (v33.1.1) to v41.0.1 fixes the issue:

cpascual@pc218:~$ docker run -d --name=taurus-stretch -h taurus-test -e DISPLAY=$DISPLAY -e QT_X11_NO_MITSHM=1 -v /tmp/.X11-unix:/tmp/.X11-unix cpascual/taurus-test:debian-stretch-py3qt5
4352af758ef01326fce19135797a7205f9752709db51721a1c9eced4e1ef202d
cpascual@pc218:~$ docker exec -it taurus-stretch bash
root@taurus-test:/# pip3 install -U setuptools
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl (575kB)
    100% |████████████████████████████████| 583kB 1.9MB/s 
Installing collected packages: setuptools
  Found existing installation: setuptools 33.1.1
    Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed setuptools-41.0.1
root@taurus-test:/# pip3 install  https://ci.appveyor.com/api/buildjobs/g0ecp4g47ybyxvky/artifacts/dist%2Ftaurus-4.6.0a0.tar.gz
Collecting https://ci.appveyor.com/api/buildjobs/g0ecp4g47ybyxvky/artifacts/dist%2Ftaurus-4.6.0a0.tar.gz
  Downloading https://ci.appveyor.com/api/buildjobs/g0ecp4g47ybyxvky/artifacts/dist%2Ftaurus-4.6.0a0.tar.gz (18.5MB)
    100% |████████████████████████████████| 18.5MB 76kB/s 
Requirement already satisfied: numpy>=1.1 in /usr/lib/python3/dist-packages (from taurus==4.6.0a0)
Collecting pint>=0.8 (from taurus==4.6.0a0)
  Downloading https://files.pythonhosted.org/packages/15/9d/bf177ebbc57d25e9e296addc14a1303d1e34d7964af5df428a8332349c42/Pint-0.9-py2.py3-none-any.whl (138kB)
    100% |████████████████████████████████| 143kB 2.1MB/s 
Requirement already satisfied: future in /usr/lib/python3/dist-packages (from taurus==4.6.0a0)
Requirement already satisfied: click in /usr/lib/python3/dist-packages (from taurus==4.6.0a0)
Building wheels for collected packages: taurus
  Running setup.py bdist_wheel for taurus ... done
  Stored in directory: /root/.cache/pip/wheels/a0/7f/7e/5a3da98bca9ac0492840705e8e8041a62b48c762046239303f
Successfully built taurus
Installing collected packages: pint, taurus
  Found existing installation: Pint 0.7.2
    Not uninstalling pint at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed pint-0.9 taurus-4.6.0a0
root@taurus-test:/# grep enum34 /usr/local/lib/python3.5/dist-packages/taurus-4.6.0a0.dist-info/METADATA
Requires-Dist: enum34; python_version < "3.4"
cpascual commented 5 years ago

IMHO we can close this bug since current versions of setuptools solve it.

The only problem is with debian9 (oldstable, stretch) which ships an affected version of setuptools.

In this case we need to keep in mind the following: