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

Fails to install with pip on Windows #140

Closed
baoilleach opened this issue Nov 9, 2016 · 6 comments
Closed

Fails to install with pip on Windows #140

baoilleach opened this issue Nov 9, 2016 · 6 comments

Comments

@baoilleach
Copy link

baoilleach commented Nov 9, 2016

Python 2.7 32-bit on Windows 7. Failed similarly with both pip 8.1.2 and 9.0.1.

(Looks like using os.path.join might solve the error below)

C:\Users\noel>C:\python27\Scripts\pip2.7.exe install eutils
Collecting eutils
  Using cached eutils-0.2.1.tar.gz
Exception:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\python27\lib\site-packages\pip\commands\install.py", line 335, in run

    wb.build(autobuilding=True)
  File "c:\python27\lib\site-packages\pip\wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "c:\python27\lib\site-packages\pip\req\req_set.py", line 380, in prepare_
files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\python27\lib\site-packages\pip\req\req_set.py", line 620, in _prepare
_file
    session=self.session, hashes=hashes)
  File "c:\python27\lib\site-packages\pip\download.py", line 821, in unpack_url
    hashes=hashes
  File "c:\python27\lib\site-packages\pip\download.py", line 663, in unpack_http
_url
    unpack_file(from_path, location, content_type, link)
  File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 605, in unpac
k_file
    untar_file(filename, location)
  File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 577, in untar
_file
    with open(path, 'wb') as destfp:
IOError: [Errno 22] invalid mode ('wb') or filename: 'c:\\users\\noel\\appdata\\
local\\temp\\pip-build-jobfjx\\eutils\\tests/data/efetch.fcgi?db=pubmed&id=23121
403&retmode=xml.xml'
@reece
Copy link
Member

reece commented Nov 21, 2016

That's probably right. I don't have access to a windows machine, so I can't fix and test. I'll wait for a motivated contributor to submit a PR.

@zeanzhou
Copy link

I've found a highly possible reason that may cause the problem above.
Linux accept a filename containing '?' (a question mark) while Windows don't. When files are extracted from .tar.gz, all question marks in filename are converted to '_' (underscore) in Windows.
Unfortunately, lots of files in tests/data/ contain a '?', and as what is described in eutils.egg-info\SOURCES.txt, Python try to find files like

einfo.fcgi?retmode=xml.xml.gz

but it has been renamed to

einfo.fcgi_retmode=xml.xml.gz

which finally leads to a failure of installation.

Is it feasible to rename those tricky files?

@reece
Copy link
Member

reece commented Feb 18, 2017

Thanks for identifying the cause. As you likely inferred, those paths refer to the URLs from which the data were obtained. If we rename them, we'll lose that connection.

There's a better solution. Those files are essentially just test data caches. I would like to migrate eutils tests to use the vcrpy, which will then cache the results in a cross-platform way.

If you're interested in taking that on, see https://github.com/reece/helix/blob/master/tests/ (particularly the bottom of conftest.py and test_helix_client.py) for an example of how it's used.

If you're not interested/able to undertake this, I'll do it sometime. It'll be pretty easy.

@reece reece closed this as completed in 7862548 Mar 1, 2017
@reece
Copy link
Member

reece commented Mar 1, 2017

@zeanzhou Would you please try this version of the package? It eliminates the test files and replaces them with request caches from vcrpy. Please confirm on this issue that it's fixed on Windows, or reopen the issue. Thanks.

@zeanzhou
Copy link

zeanzhou commented Mar 1, 2017

@reece Cool! Now it works well on my Windows laptop! Much appreciated 👍 =)

@reece
Copy link
Member

reece commented Mar 1, 2017

Great. I appreciate the confirmation. pypi packages coming shortly...

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

3 participants