Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latest pypi release shows wrong version on pip freeze #123

Closed
tuky opened this issue Feb 12, 2019 · 25 comments
Closed

latest pypi release shows wrong version on pip freeze #123

tuky opened this issue Feb 12, 2019 · 25 comments

Comments

@tuky
Copy link

tuky commented Feb 12, 2019

see below for my installation process on ubuntu 18.10. pip freeze gives me cairocffi===file-.cairocffi-VERSION.

tuky@Quiet:/tmp$ python3.6 -m venv /tmp/cairoenv
tuky@Quiet:/tmp$ source /tmp/cairoenv/bin/activate
(cairoenv) tuky@Quiet:/tmp$ pip install -U pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Using cached https://files.pythonhosted.org/packages/d7/41/34dd96bd33958e52cb4da2f1bf0818e396514fd4f4725a79199564cd0c20/pip-19.0.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-19.0.2
(cairoenv) tuky@Quiet:/tmp$ pip install -U wheel
Collecting wheel
  Using cached https://files.pythonhosted.org/packages/7c/d7/20bd3c501f53fdb0b7387e75c03bd1fce748a1c3dd342fc53744e28e3de1/wheel-0.33.0-py2.py3-none-any.whl
Installing collected packages: wheel
Successfully installed wheel-0.33.0
(cairoenv) tuky@Quiet:/tmp$ pip install -U cairocffi
Collecting cairocffi
  Using cached https://files.pythonhosted.org/packages/3e/f1/0d1dad825f6ec75d3d79d5673e7b836e7a23bf57fde0028fb8bf252d4259/cairocffi-1.0.1.tar.gz
Collecting cffi>=1.1.0 (from cairocffi)
  Using cached https://files.pythonhosted.org/packages/6d/c0/47db8f624f3e4e2f3f27be03a93379d1ba16a1450a7b1aacfa0366e2c0dd/cffi-1.11.5-cp36-cp36m-manylinux1_x86_64.whl
Collecting pycparser (from cffi>=1.1.0->cairocffi)
Building wheels for collected packages: cairocffi
  Building wheel for cairocffi (setup.py) ... done
  Stored in directory: /home/tuky/.cache/pip/wheels/8d/f0/05/cb8797e3c39d8475b89381d5ac3e3f6d26484ca317abc0c2ce
Successfully built cairocffi
Installing collected packages: pycparser, cffi, cairocffi
Successfully installed cairocffi-file-.cairocffi-VERSION cffi-1.11.5 pycparser-2.19
(cairoenv) tuky@Quiet:/tmp$ pip freeze
cairocffi===file-.cairocffi-VERSION
cffi==1.11.5
pkg-resources==0.0.0
pycparser==2.19
(cairoenv) tuky@Quiet:/tmp$ python --version
Python 3.6.7
(cairoenv) tuky@Quiet:/tmp$ pip --version
pip 19.0.2 from /tmp/cairoenv/lib/python3.6/site-packages/pip (python 3.6)
@jontycg
Copy link

jontycg commented Feb 12, 2019

This issue caused Weasyprint to not install for me citing that it needed a version of cairocffi >= 0.9.0. For the time being I fixed the issue by specifying the version for cairocffi to be 1.0.0 in requirements.txt.

@liZe
Copy link
Member

liZe commented Feb 12, 2019

We now need a more recent of setuptools (you can get rid of this problem by upgrading setuptools before installing). I should update the version needed in the requirements.

@jasongi-actu
Copy link

this really should have been a major, not a patch release.

@liZe
Copy link
Member

liZe commented Feb 14, 2019

this really should have been a major, not a patch release.

1.0.0 is a major, isn't it?

@jasongi-actu
Copy link

jasongi-actu commented Feb 15, 2019

1.0.0 is a major, isn't it?

1.0.0 works fine, 1.0.1 has the breaking change.

@liZe
Copy link
Member

liZe commented Feb 15, 2019

1.0.0 works fine, 1.0.1 has the breaking change.

Oh, then it's probably because we didn't release a wheel. I have to find a solution about that.

@liZe liZe closed this as completed in 7aca28e Feb 15, 2019
@liZe
Copy link
Member

liZe commented Feb 15, 2019

Adding the needed version of setuptools to setup.cfg seems to fix the problem. I'll release 1.0.2 soon, sorry for the inconvenience.

@liZe
Copy link
Member

liZe commented Feb 15, 2019

Looks like it's not fixed: https://travis-ci.org/Kozea/WeasyPrint/jobs/493713422

@liZe
Copy link
Member

liZe commented Feb 15, 2019

Looks like it's not fixed: https://travis-ci.org/Kozea/WeasyPrint/jobs/493713422

Well, it's a bit more complicated. Installation works with old versions of setuptools, but launching tests doesn't. Launching python setup.py doesn't reload setuptools, and thus it fails as tests are launched with the old setuptools (even if the new one is installed). I think that we can live with that.

@whyscream
Copy link

This still doesn't work for me with 1.0.1 and 1.0.2. The change in the setup script requires the newer setuptools during install but setuptools is also listed (without version in setup_requires). Could it be that pinning there solves this issue?

I'm now getting:

Collecting cairocffi==1.0.2 (from -r /app/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/0f/0f/7e21b5ddd31b610e46a879c0d21e222dd0fef428c1fc86bbd2bd57fed8a7/cairocffi-1.0.2.tar.gz (68kB)
  Running setup.py (path:/tmp/pip-build-f8d10dda/cairocffi/setup.py) egg_info for package cairocffi produced metadata for project name unknown. Fix your #egg=cairocffi fragments.
Building wheels for collected packages: unknown, unknown
  Running setup.py bdist_wheel for unknown: started
  Running setup.py bdist_wheel for unknown: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/e7/5d/6f/fc3c2364dfd3c4cfd15d786b156077c52209d9af45496fdf12
  Running setup.py bdist_wheel for unknown: started
  Running setup.py bdist_wheel for unknown: finished with status 'error'
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-f8d10dda/unknown/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpe1dm50ycpip-wheel- --python-tag cp35:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/usr/lib/python3.5/tokenize.py", line 454, in open
      buffer = _builtin_open(filename, 'rb')
  FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-f8d10dda/unknown/setup.py'
  
  ----------------------------------------
  Failed building wheel for unknown
  Running setup.py clean for unknown
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-f8d10dda/unknown/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" clean --all:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/usr/lib/python3.5/tokenize.py", line 454, in open
      buffer = _builtin_open(filename, 'rb')
  FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-f8d10dda/unknown/setup.py'
  
  ----------------------------------------
  Failed cleaning build dir for unknown
Successfully built unknown
Failed to build unknown
Installing collected packages: unknown
Successfully installed unknown-0.0.0

This is on a docker ubuntu 16.04 image, pre-installed setuptools == 20.7.0.

@liZe
Copy link
Member

liZe commented Mar 8, 2019

Could it be that pinning there solves this issue?

Can you try to download the current tree, pin the setup_requires version and try to install cairocffi with that change?

@whyscream
Copy link

I just tried, but it doesn't work :(

@liZe
Copy link
Member

liZe commented Mar 8, 2019

Then I'm afraid setuptools == 20.7.0 is really too old.

@whyscream
Copy link

Which awesome feature did you start using between 1.0.0 and 1.0.1 that requires the newer setuptools? 1.0.0. does work.

@liZe
Copy link
Member

liZe commented Mar 8, 2019

Which awesome feature did you start using between 1.0.0 and 1.0.1 that requires the newer setuptools? 1.0.0. does work.

The only commit between 1.0.0 and 1.0.1 is 07802d7, fixing #120.

@liZe
Copy link
Member

liZe commented Mar 8, 2019

The real difference is that we don't distribute wheels anymore, as cffi requires a compilation step during installation. Installing from source requires a more recent version of setuptools.

@whyscream
Copy link

whyscream commented Mar 8, 2019

Ah, yes. When I use pip3 install --no-binary :all: , install of 1.0.0. fails too, but 0.9.0 still works. Looks like the change was here: c93eb81 (switching to setup.cfg in stead of setup.py)

@morganwahl
Copy link

morganwahl commented Aug 11, 2019

In case anyone ends up here like I did, there's some awful pip behavior on display.

If you install cairocffi with a version of setuptools that's too old, pip will build cairocffi with that old setuptools, producing a broken build with this nonsense version number, and then it will upgrade setuptools because it knows cairocffi doesn't work with the old one. But you'll still have the broken build.

And it's actually even worse: if you uninstall and reinstall cairocffi with the upgraded setuptools, you'll still get the broken build because pip cached it. For me, doing rm -rf ~/.cache/pip fixed that.

@liZe
Copy link
Member

liZe commented Aug 11, 2019

If you install cairocffi with a version of setuptools that's too old, pip will build cairocffi with that old setuptools, producing a broken build with this nonsense version number, and then it will upgrade setuptools because it knows cairocffi doesn't work with the old one. But you'll still have the broken build.

1.0.2 is supposed to prevent this, as setuptools >= 39.2.0 is required in setup.cfg. Why didn't pip upgrade setuptools before installing cairocffi?

@morganwahl
Copy link

morganwahl commented Aug 12, 2019

@liZe My exact steps were:

morgan@morgan-zbook-774:~$ rm -rf ~/.cache/pip
morgan@morgan-zbook-774:~$ virtualenv -p $(which python3) temp
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/morgan/temp/bin/python3
Also creating executable in /home/morgan/temp/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
morgan@morgan-zbook-774:~$ temp/bin/pip install 'setuptools<39'
Collecting setuptools<39
  Downloading https://files.pythonhosted.org/packages/f3/8d/74c86edb326ee18c0ffbec9d0a97f6b5a519f6449a64d21673b29e67b8db/setuptools-38.7.0-py2.py3-none-any.whl (490kB)
     |████████████████████████████████| 491kB 15.0MB/s 
Installing collected packages: setuptools
  Found existing installation: setuptools 41.0.1
    Uninstalling setuptools-41.0.1:
      Successfully uninstalled setuptools-41.0.1
Successfully installed setuptools-38.7.0
morgan@morgan-zbook-774:~$ temp/bin/pip install cairocffi
Collecting cairocffi
  Downloading https://files.pythonhosted.org/packages/0f/0f/7e21b5ddd31b610e46a879c0d21e222dd0fef428c1fc86bbd2bd57fed8a7/cairocffi-1.0.2.tar.gz (68kB)
     |████████████████████████████████| 71kB 13.4MB/s 
Collecting cffi>=1.1.0 (from cairocffi)
  Downloading https://files.pythonhosted.org/packages/5f/bf/6aa1925384c23ffeb579e97a5569eb9abce41b6310b329352b8252cee1c3/cffi-1.12.3-cp36-cp36m-manylinux1_x86_64.whl (430kB)
     |████████████████████████████████| 440kB 15.2MB/s 
Collecting setuptools>=39.2.0 (from cairocffi)
  Using cached https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl
Collecting pycparser (from cffi>=1.1.0->cairocffi)
  Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB)
     |████████████████████████████████| 163kB 16.3MB/s 
Building wheels for collected packages: cairocffi, pycparser
  Building wheel for cairocffi (setup.py) ... done
  Created wheel for cairocffi: filename=cairocffi-file_.cairocffi_VERSION-cp36-none-any.whl size=88550 sha256=9255bf27c4b80d3a1e1cee67211a3fded1c9581868a03c7fec89f66183591419
  Stored in directory: /home/morgan/.cache/pip/wheels/e7/5d/6f/fc3c2364dfd3c4cfd15d786b156077c52209d9af45496fdf12
  Building wheel for pycparser (setup.py) ... done
  Created wheel for pycparser: filename=pycparser-2.19-py2.py3-none-any.whl size=111020 sha256=d01b8f2ead4416383bcc4ae0e1e82c1a1acdb07912ac66d4b8ee2a3e42a2b97f
  Stored in directory: /home/morgan/.cache/pip/wheels/f2/9a/90/de94f8556265ddc9d9c8b271b0f63e57b26fb1d67a45564511
Successfully built cairocffi pycparser
Installing collected packages: pycparser, cffi, setuptools, cairocffi
  Found existing installation: setuptools 38.7.0
    Uninstalling setuptools-38.7.0:
      Successfully uninstalled setuptools-38.7.0
Successfully installed cairocffi-file-.cairocffi-VERSION cffi-1.12.3 pycparser-2.19 setuptools-41.0.1
morgan@morgan-zbook-774:~$ temp/bin/pip uninstall cairocffi
Uninstalling cairocffi-file-.cairocffi-VERSION:
  Would remove:
    /home/morgan/temp/lib/python3.6/site-packages/cairocffi-file_.cairocffi_VERSION.dist-info/*
    /home/morgan/temp/lib/python3.6/site-packages/cairocffi/*
Proceed (y/n)? y
  Successfully uninstalled cairocffi-file-.cairocffi-VERSION
morgan@morgan-zbook-774:~$ temp/bin/pip install cairocffi
Collecting cairocffi
Requirement already satisfied: setuptools>=39.2.0 in ./temp/lib/python3.6/site-packages (from cairocffi) (41.0.1)
Requirement already satisfied: cffi>=1.1.0 in ./temp/lib/python3.6/site-packages (from cairocffi) (1.12.3)
Requirement already satisfied: pycparser in ./temp/lib/python3.6/site-packages (from cffi>=1.1.0->cairocffi) (2.19)
Installing collected packages: cairocffi
Successfully installed cairocffi-file-.cairocffi-VERSION
morgan@morgan-zbook-774:~$ temp/bin/pip uninstall cairocffi
Uninstalling cairocffi-file-.cairocffi-VERSION:
  Would remove:
    /home/morgan/temp/lib/python3.6/site-packages/cairocffi-file_.cairocffi_VERSION.dist-info/*
    /home/morgan/temp/lib/python3.6/site-packages/cairocffi/*
Proceed (y/n)? y
  Successfully uninstalled cairocffi-file-.cairocffi-VERSION
morgan@morgan-zbook-774:~$ rm -rf ~/.cache/pip
morgan@morgan-zbook-774:~$ temp/bin/pip install cairocffi
Collecting cairocffi
  Downloading https://files.pythonhosted.org/packages/0f/0f/7e21b5ddd31b610e46a879c0d21e222dd0fef428c1fc86bbd2bd57fed8a7/cairocffi-1.0.2.tar.gz (68kB)
     |████████████████████████████████| 71kB 14.0MB/s 
Requirement already satisfied: cffi>=1.1.0 in ./temp/lib/python3.6/site-packages (from cairocffi) (1.12.3)
Requirement already satisfied: setuptools>=39.2.0 in ./temp/lib/python3.6/site-packages (from cairocffi) (41.0.1)
Requirement already satisfied: pycparser in ./temp/lib/python3.6/site-packages (from cffi>=1.1.0->cairocffi) (2.19)
Building wheels for collected packages: cairocffi
  Building wheel for cairocffi (setup.py) ... done
  Created wheel for cairocffi: filename=cairocffi-1.0.2-cp36-none-any.whl size=88348 sha256=ba0c2dc2bcd602a192ff3b118d30bb731ee26068a8417ca9ed730a3d078e1b46
  Stored in directory: /home/morgan/.cache/pip/wheels/e7/5d/6f/fc3c2364dfd3c4cfd15d786b156077c52209d9af45496fdf12
Successfully built cairocffi
Installing collected packages: cairocffi
Successfully installed cairocffi-1.0.2
morgan@morgan-zbook-774:~$ 

As you can see, pip does upgrade setuptools while installing cairocffi, but it makes that broken build of cairocffi first. And then proceeds to keep using the cached broken build even though setuptools is upgraded.

This is very much a pip bug (or bugs), not a cairocffi one. I just thought I'd comment here since this comes up when you search for "file-.cairocffi-VERSION", and it's not easy to debug.

@morganwahl
Copy link

morganwahl commented Aug 12, 2019

I'm not a pip expert; does it have a way to specify a build time dependency instead of a run time dependency? Cause it seems like that's exactly what you need.

Also, it needs to not be using a cached build with version numbers that aren't at all what you asked for, but that's a separate issue.

@liZe
Copy link
Member

liZe commented Aug 12, 2019

As you can see, pip does upgrade setuptools while installing cairocffi, but it makes that broken build of cairocffi first. And then proceeds to keep using the cached broken build even though setuptools is upgraded.

This is very much a pip bug (or bugs), not a cairocffi one. I just thought I'd comment here since this comes up when you search for "file-.cairocffi-VERSION", and it's not easy to debug.

Oh, yes… Pip upgrades setuptools before building cairocffi, but as installing and building is done in the same process (that uses the old version of setuptools), it doesn't work. Pip should reload setuptools before building, but nobody cares because upgrading setuptools before installing a package is a really easy workaround.

Maybe we could open an issue.

@liZe
Copy link
Member

liZe commented Aug 12, 2019

(By the way, many package managers for Linux distributions upgrade (with deps) and reload themselves before upgrading the other packages.)

@morganwahl
Copy link

(Oh, I'm well aware. Sometimes I wish the Python community just used portage or some other established tool.)

@liZe
Copy link
Member

liZe commented Aug 12, 2019

portage

😍

netbsd-srcmastr referenced this issue in NetBSD/pkgsrc Apr 30, 2024
Version 1.7.0
.............

Released on 2024-04-27

* Drop Python 3.7 support, add Python 3.12 support
* `#221 <https://github.com/Kozea/cairocffi/pull/225>`_:
  Add environment variable to set folder where DLLs are installed on Windows
* `#225 <https://github.com/Kozea/cairocffi/pull/225>`_:
  Use Ruff instead of Flake8 and isort


Version 1.6.1
.............

Released on 2023-07-24

* `#217 <https://github.com/Kozea/cairocffi/issues/217>`_:
  Repair installation with PyInstaller


Version 1.6.0
.............

Released on 2023-06-12

**This version uses a new CFFI mode that may break your program.**

CairoCFFI now uses Flit for packaging and is also distributed as a Python
wheel.

Please test carefully and don’t hesitate to report issues before using it in
production.

* `#216 <https://github.com/Kozea/cairocffi/pull/216>`_:
  Use ABI-level in-line CFFI mode


Version 1.5.1
.............

Released on 2023-04-15

* `#212 <https://github.com/Kozea/cairocffi/issues/212>`_:
  Bring back XCB support during wheel generation


Version 1.5.0
.............

Released on 2023-03-17

* `#106 <https://github.com/Kozea/cairocffi/issues/106>`_,
  `#200 <https://github.com/Kozea/cairocffi/issues/200>`_:
  Fallback to manual PNG file creation on hardened systems
* `#210 <https://github.com/Kozea/cairocffi/pull/210>`_:
  Use pyproject.toml for packaging and remove other useless files


Version 1.4.0
.............

Released on 2022-09-23

* `#205 <https://github.com/Kozea/cairocffi/pull/205>`_:
  Use pikepdf to parse generated PDF
* `#171 <https://github.com/Kozea/cairocffi/pull/171>`_:
  Don’t use deprecated pytest-runner anymore


Version 1.3.0
.............

Released on 2021-10-04

* `2cd512d <https://github.com/Kozea/cairocffi/commit/2cd512d>`_:
  Drop Python 3.6 support
* `#196 <https://github.com/Kozea/cairocffi/pull/196>`_:
  Fix import `constants.py` import
* `#169 <https://github.com/Kozea/cairocffi/pull/169>`_:
  Add extra library name "cairo-2.dll"
* `#178 <https://github.com/Kozea/cairocffi/pull/178>`_:
  Workaround for testing date string with cairo 1.17.4
* `#186 <https://github.com/Kozea/cairocffi/pull/186>`_:
  Fix link in documentation
* `#195 <https://github.com/Kozea/cairocffi/pull/195>`_:
  Fix typo in documentation
* `#184 <https://github.com/Kozea/cairocffi/pull/184>`_,
  `a4fc2a7 <https://github.com/Kozea/cairocffi/commit/a4fc2a7>`_:
  Clean .gitignore


Version 1.2.0
.............

Released on 2020-10-29

* `#152 <https://github.com/Kozea/cairocffi/pull/152>`_:
  Add NumPy support
* `#143 <https://github.com/Kozea/cairocffi/issues/143>`_:
  Make write_to_png function work on hardened systems
* `#156 <https://github.com/Kozea/cairocffi/pull/156>`_:
  Use major version name to open shared libraries
* `#165 <https://github.com/Kozea/cairocffi/pull/165>`_:
  Don’t list setuptools as required for installation


Version 1.1.0
.............

Released on 2019-09-05

* `#135 <https://github.com/Kozea/cairocffi/pull/135>`_,
  `#127 <https://github.com/Kozea/cairocffi/pull/127>`_,
  `#119 <https://github.com/Kozea/cairocffi/pull/119>`_:
  Clean the way external libraries are found
* `#126 <https://github.com/Kozea/cairocffi/pull/126>`_:
  Remove const char* elements from cdef
* Support Cairo features up to 1.17.2
* Fix documentation generation


Version 1.0.2
.............

Released on 2019-02-15

* `#123 <https://github.com/Kozea/cairocffi/issues/123>`_:
  Rely on a recent version of setuptools to handle VERSION


Version 1.0.1
.............

Released on 2019-02-12

* `#120 <https://github.com/Kozea/cairocffi/issues/120>`_:
  Don't delete _generated modules on ffi_build import


Version 1.0.0
.............

Released on 2019-02-08

6 years after its first release, cairocffi can now be considered as stable.

* Drop Python 2.6, 2.7 and 3.4 support
* Test with Python 3.7
* Clean code, tests and packaging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants