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

Pywin32 - Release 226 breaks Virtualenv. #1439

Closed
KelSolaar opened this issue Nov 10, 2019 · 11 comments
Closed

Pywin32 - Release 226 breaks Virtualenv. #1439

KelSolaar opened this issue Nov 10, 2019 · 11 comments

Comments

@KelSolaar
Copy link

Note that issues in this repository are only for bugs or feature requests in the pywin32.

If you need support or help using this package, please follow these instructions - support or help requests will be closed without comment.

For all bugs, please provide the following information.

  • Expected behavior and actual behavior.

Pip installation of packages in virtual environments after having installed Pywin32 should work.

  • Steps to reproduce the problem.

I'm not exactly sure what is happening but it seems like Pywin32 - Release 226 overrides the site.py module to a degree: https://github.com/colour-science/colour/runs/296273919#step:6:71

2019-11-10T09:31:49.6665830Z   - Installing pywin32 (226)
2019-11-10T09:31:55.9900265Z   - Installing traitlets (4.3.3)
2019-11-10T09:31:56.0385213Z 
2019-11-10T09:31:56.0385876Z [EnvCommandError]
2019-11-10T09:31:56.0386325Z Command ['C:\\Users\\runneradmin\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\colour-9UyTvm6t-py2.7\\Scripts\\python.exe', '-m', 'pip', 'install', '--no-deps', 'traitlets==4.3.3'] errored with the following return code 1, and output: 
2019-11-10T09:31:56.0386682Z Traceback (most recent call last):
2019-11-10T09:31:56.0386831Z 
2019-11-10T09:31:56.0390404Z   File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\colour-9UyTvm6t-py2.7\lib\site.py", line 769, in <module>
2019-11-10T09:31:56.0391101Z 
2019-11-10T09:31:56.0391696Z     main()
2019-11-10T09:31:56.0391836Z 
2019-11-10T09:31:56.0392174Z   File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\colour-9UyTvm6t-py2.7\lib\site.py", line 746, in main
2019-11-10T09:31:56.0392414Z 
2019-11-10T09:31:56.0392683Z     paths_in_sys = addsitepackages(paths_in_sys)
2019-11-10T09:31:56.0392841Z 
2019-11-10T09:31:56.0393147Z   File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\colour-9UyTvm6t-py2.7\lib\site.py", line 279, in addsitepackages
2019-11-10T09:31:56.0393361Z 
2019-11-10T09:31:56.0393635Z     addsitedir(sitedir, known_paths)
2019-11-10T09:31:56.0393778Z 
2019-11-10T09:31:56.0394067Z   File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\colour-9UyTvm6t-py2.7\lib\site.py", line 202, in addsitedir
2019-11-10T09:31:56.0394280Z 
2019-11-10T09:31:56.0394499Z     addpackage(sitedir, name, known_paths)
2019-11-10T09:31:56.0394700Z 
2019-11-10T09:31:56.0394997Z   File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\colour-9UyTvm6t-py2.7\lib\site.py", line 170, in addpackage
2019-11-10T09:31:56.0395160Z 
2019-11-10T09:31:56.0395377Z     exec(line)
2019-11-10T09:31:56.0395557Z 
2019-11-10T09:31:56.0395843Z   File "<string>", line 1, in <module>
2019-11-10T09:31:56.0395993Z 
2019-11-10T09:31:56.0396291Z   File "C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\colour-9UyTvm6t-py2.7\lib\site-packages\win32\lib\pywin32_bootstrap.py", line 14, in <module>
2019-11-10T09:31:56.0396511Z 
2019-11-10T09:31:56.0397903Z     for maybe in site.getsitepackages():
2019-11-10T09:31:56.0398374Z 
2019-11-10T09:31:56.0399692Z AttributeError: 'module' object has no attribute 'getsitepackages'

Pretty much same build with Release 225 was fine yesterday: https://github.com/colour-science/colour/commit/b8399d28760179f46f7090dd69457565d1754403/checks?check_suite_id=303070722#step:6:42

  • Version of Python and pywin32

Python 2.7 and Pywin32 - Release 226

Cheers,

Thomas

s-weigand added a commit to s-weigand/flake8-nb that referenced this issue Nov 10, 2019
coldino added a commit to arkutils/Purlovia that referenced this issue Nov 10, 2019
Version 226 of pywin32 fails to install inside a virtual environment. See mhammond/pywin32#1439.
blackchoey added a commit to Azure/iotedgehubdev that referenced this issue Nov 11, 2019
uellue added a commit to uellue/LiberTEM that referenced this issue Nov 11, 2019
sk1p pushed a commit to LiberTEM/LiberTEM that referenced this issue Nov 11, 2019
mtreinish added a commit to mtreinish/qiskit-ignis that referenced this issue Nov 11, 2019
Pywin32 was release on Nov. 10 and introduced an issue when running
virtualenv on windows, mhammond/pywin32#1439. This causes our ci system
to fail when trying to run the windows jobs because tox is uses
virtualenv underneath. This commit adds a pin via the constraints file
to ensure that we are installing the older version which does not have
this problem.
@vashek
Copy link

vashek commented Nov 11, 2019

This is because of pypa/virtualenv#228 (and it break pipenv as a consequence, too).
This is the commit in pywin32 that caused it: 71afa71#diff-1fbc440d4725e98acddc7667ffb63fe6

@CMTaylor
Copy link

I'm having this issue, too. Going back to 225 is a workaround for now.

mtreinish added a commit to qiskit-community/qiskit-ignis that referenced this issue Nov 11, 2019
Pywin32 was release on Nov. 10 and introduced an issue when running
virtualenv on windows, mhammond/pywin32#1439. This causes our ci system
to fail when trying to run the windows jobs because tox is uses
virtualenv underneath. This commit adds a pin via the constraints file
to ensure that we are installing the older version which does not have
this problem.
Celeborn2BeAlive added a commit to Celeborn2BeAlive/jupyter-venv that referenced this issue Nov 11, 2019
@tueksta
Copy link

tueksta commented Nov 12, 2019

It would be good to also add some tests for the virtual environment use case, so that a commit like this could be caught earlier.

@gsemet
Copy link

gsemet commented Nov 12, 2019

Indeed, I have this with virtualenv 16.1.0.

@fabiencelier
Copy link

Same problem with windows 10 and python 3.7

janisz added a commit to dcos/dcos-core-cli that referenced this issue Nov 12, 2019
We can use pywin 226 need to stick to 225.

See: mhammond/pywin32#1439
@elembie
Copy link

elembie commented Nov 13, 2019

Same issue here on python 3.7.5 64 bit, windows 10, virtualenv 16.7.7. Is anyone able to elaborate on the workaround setting the pywin version to an earlier one (e.g. when pip installing packages into the virtualenv)? Makes sense from requirements.txt or similar but I'm unsure how to fix this in packages I'm installing.

@jesserobertson
Copy link

jesserobertson commented Nov 13, 2019

@elembie and anyone else who is looking, you can specify that you don't want version 226 for pywin. I'm using pipenv so something like

[packages]
pywin32 = {version = "!= 226", sys_platform = "== 'win32'"}

or similar in your requirements.txt (something like pywin32!=222 from memory) should mean that the resolver uses an earlier (non-broken) version.

If you're installing with pip I think you can just specify the version directly

$ pip install 'pywin32!=226'  # add --force-reinstall if necessary

jesserobertson pushed a commit to IGSN/igsn-registry-mvp that referenced this issue Nov 13, 2019
s-weigand added a commit to s-weigand/flake8-nb that referenced this issue Nov 13, 2019
s-weigand added a commit to s-weigand/python-tools-for-students that referenced this issue Nov 13, 2019
@s-weigand
Copy link

For all who struggle to get tox running again, as I did, here is my solution:

  1. Add a file constrains.txt at the root of your project, which contains:
    pywin32!=226
    
  2. Add the following line to your tox.ini in the most common testsenv configuration (i.e. [testenv]):
    install_command=python -m pip install -c {toxinidir}/constraints.txt {opts} {packages}
    

This will prevent the installation of pywin32==226 in your virtualenv (also works on linux and OsX CI).

s-weigand added a commit to s-weigand/python-tools-for-students that referenced this issue Nov 13, 2019
s-weigand added a commit to s-weigand/python-tools-for-students that referenced this issue Nov 13, 2019
s-weigand added a commit to s-weigand/python-tools-for-students that referenced this issue Nov 13, 2019
janisz added a commit to dcos/dcos-core-cli that referenced this issue Nov 13, 2019
@mhammond
Copy link
Owner

Sorry for the inconvenience - this should be fixed in build 227

@KelSolaar
Copy link
Author

Thanks @mhammond !

@s-weigand
Copy link

@mhammond Thanks for the quick fix 😃

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

10 participants