Skip to content

builtins import broken in version 0.17.0 #398

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

Closed
e-rk opened this issue Oct 26, 2018 · 14 comments
Closed

builtins import broken in version 0.17.0 #398

e-rk opened this issue Oct 26, 2018 · 14 comments

Comments

@e-rk
Copy link

e-rk commented Oct 26, 2018

Importing builtins in version 0.17.0 causes error.

>>> import builtins
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named builtins
>>> 
@gillesdouaire
Copy link

We have the same issue here.

Trying to point the origin of the issue, but it's not yet clear.

@sylvainduchesne
Copy link

We have the same issue, but interestingly, if we pip install without cache dir, it works...

pip install -U --force   future
>>> import builtins
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named builtins
>>>
pip install -U --force  --no-cache-dir future
>>> import builtins
>>>

@gillesdouaire
Copy link

gillesdouaire commented Oct 26, 2018

on Windows, removing the cached future 0.17.0 whl from C:\Users<username>\AppData\Local\pip and then re-installing the package fixes it.

so it looks (It's a theory) like earlier publication of 0.17.0 was broken, but now is fixed.

@gillesdouaire
Copy link

@jmadler let us know what happened, we'd like to understand the context.

@daa
Copy link
Contributor

daa commented Oct 26, 2018

Tell me please haven't you built future wheel with Python-3 and tried to use it with Python-2? If so this may be the cause of issue.

@gillesdouaire
Copy link

well if the future wheel is built by python 3, cached as universal, and then retrieved by python 2 from the cache, that could be it.

@jmadler
Copy link
Contributor

jmadler commented Oct 27, 2018

Sorry folks! This is my first distribution of this particular package (and PyPI as well...)

When I made the build I ran python setup.py sdist with Py3, and tested pip install dist/future-0.17.0.tgz on both Py2 and Py3 and validated it installed via that mechanism. I conducted install validation by testing a few imports and dir() on the REPL for builtins, reprlib, and future

Once validated I ran twine upload dist/future-0.17.0.tgz to get it up to PyPI.

pip2 --version && pip3 --version:

pip 10.0.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
pip 18.0 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

Another possibility is that the local bdist_wheel is built on Py3 and cached somewhere and treated as universal (when it's not), but I didn't upload a wheel to PyPI.

I'm unable to repro in an empty venv with pip install future==0.17.0 for Py2 and Py3 on my macOS machine.

Is it possible that PyPI is rewriting the package somehow? Or perhaps the behavior of pip has changed?

@mrquokka
Copy link

on Windows, removing the cached future 0.17.0 whl from C:\Users\AppData\Local\pip and then re-installing the package fixes it.

so it looks (It's a theory) like earlier publication of 0.17.0 was broken, but now is fixed.

I think too. Maybe can someone release 0.17.1 with fix)

@sylvainduchesne
Copy link

Indeed, if the package is installed via py3, it will be cached in the local pip cache. Any future installations of future (beit py2 or py3) will use this cached version as its marked universal.

However, the setup.py https://github.com/PythonCharmers/python-future/blob/master/setup.py#L61 has that conditional that makes the generated wheel (now in the pip cache) incompatible for py2 (since it was built for py3). I imagine that if the wheel is generated via py2, it could mean bad news for a py3 install.

@vphilippon
Copy link
Contributor

@jmadler The issue is addressed in master, the only remaining thing would be to merge PR #404 and release v0.17.1

Right now, with v0.17.0, any user using both Py2 and Py3 on their machine is at risk of getting a bad pip wheel cache and hit this error.

Is it possible to get a release out ASAP? If you have any questions/concerns, ask away, I'll be happy to help 😃

@jmadler
Copy link
Contributor

jmadler commented Oct 31, 2018

Sounds good, I released 0.17.1 with #399 and #404 included. Can you take a look and let me know if it addresses this issue for you?

@gillesdouaire
Copy link

gillesdouaire commented Oct 31, 2018

A1 - fixed.

Steps:

  1. Spin a virgin Windows 10 machine with Python 3.6 and Python 2.7 installed

  2. pip install future in a Python 3.6 context -- confirm the wheel is built and cached
    py -3.6 -m pip install future
    cached wheel: future-0.17.1-cp36-none-any.whl

  3. pip install future in a Python 2.7 context -- confirm the wheel is built again and not using the cached version from step 2)
    py -2.7 -m pip install future
    cached wheel: future-0.17.1-cp27-none-any.whl

  4. In a Python 2 session, import builtins and no errors happen
    py -2.7
    Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.

    import builtins

by comparision 0.17.0 did have this single wheel: future-0.17.0-py2.py3-none-any.whl

@daa
Copy link
Contributor

daa commented Oct 31, 2018

I had this issue with 0.17.0 and can confirm that 0.17.1 fixed it.

crwood added a commit to gridsync/gridsync that referenced this issue Oct 31, 2018
The issue addressed by f895bb0 appears to have been fixed upstream.
See PythonCharmers/python-future#398
@jmadler
Copy link
Contributor

jmadler commented Oct 31, 2018

Glad to hear it!

Thanks Gilles, Vincent, et al. Your guidance has been super helpful :)

@jmadler jmadler closed this as completed Nov 7, 2018
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

7 participants