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

Cannot install editable package #1133

Closed
eugenma opened this issue Nov 28, 2017 · 5 comments
Closed

Cannot install editable package #1133

eugenma opened this issue Nov 28, 2017 · 5 comments

Comments

@eugenma
Copy link

eugenma commented Nov 28, 2017

I wanted to install a package on a local drive as an editable package under Windows:

D:\projects\myproject>pipenv install -e D:\projects\DjangoApps\mypackage
Describe your environment
  1. OS: Windows 10 Pro, 64 bit
  2. Python version: Python 3.6.1
  3. Pipenv version: pipenv, version 8.3.2
Expected result

the package is listed in Pipfile and myproject finds the mypackage dependency

Actual result

The following error occurs:

Installing -e D:\projects\DjangoApps\mypackage…
Traceback (most recent call last):
  File "c:\program files (x86)\python36-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files (x86)\python36-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files (x86)\Python36-32\Scripts\pipenv.exe\__main__.py", line 9, in <module>
  File "c:\program files (x86)\python36-32\lib\site-packages\pipenv\vendor\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\program files (x86)\python36-32\lib\site-packages\pipenv\vendor\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\program files (x86)\python36-32\lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\program files (x86)\python36-32\lib\site-packages\pipenv\vendor\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\program files (x86)\python36-32\lib\site-packages\pipenv\vendor\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\program files (x86)\python36-32\lib\site-packages\pipenv\cli.py", line 1880, in install
    converted = convert_deps_from_pip(package_name)
  File "c:\program files (x86)\python36-32\lib\site-packages\pipenv\utils.py", line 547, in convert_deps_from_pip
    os.path.isfile(req.name)) and not req.vcs:
  File "c:\program files (x86)\python36-32\lib\genericpath.py", line 30, in isfile
    st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType  
Solution

I checked the code in pyenv/utils.py and at the line 547, i.e. around:

[...]
  if (req.uri or (os.path.isfile(req.path) if req.path else False) or
        os.path.isfile(req.name)) and not req.vcs:
[...]

the error occurs because req.name is None. Hence the simple solution is check as for req.path:

if (req.uri or (os.path.isfile(req.path) if req.path else False) or
        (os.path.isfile(req.name) if req.name else False)) and not req.vcs:

At least on my pc it worked. The Pipfile looks as follows after installing the editable package:

[packages]
...
django = "==1.10.5"
"-e d:\projects\djangoapps\mypackage" = "*"

@chenull
Copy link

chenull commented Nov 28, 2017

@eugenma using master version, this issue should have been resolved. i think this is related to #1126, which is fixed in c9ae370. I've tried it on my mac, but not windows.

@techalchemy
Copy link
Member

This one was actually fixed in #958, but if you want to install using absolute paths you should use file:// URIs e.g. pipenv install -e file:///d:/projects/djangoapps/mypackage as that is how they are resolved on the backend anyway

@chenull
Copy link

chenull commented Nov 29, 2017

using latest release (8.3.2) i can confirm that the problem still exists, i was about to report this problem when i found @eugenma has already post this issue, whether using file:/// or abspath. my pipenv installed using pipsi

pipenv, version 8.3.2


$ pipenv install -e file:///Users/ayik/Repo/Django/django
Installing -e file:///Users/ayik/Repo/Django/django…
Traceback (most recent call last):
...
  File "/Users/ayik/.local/venvs/pipenv/bin/../lib/python3.6/genericpath.py", line 30, in isfile
    st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType


$ pipenv install -e ~/Repo/Django/django
Installing -e /Users/ayik/Repo/Django/django…
Traceback (most recent call last):
...
  File "/Users/ayik/.local/venvs/pipenv/bin/../lib/python3.6/genericpath.py", line 30, in isfile
    st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

but anyway, it already fixed on master 🎉

@techalchemy
Copy link
Member

@chenull that should be right, the fix from #958 hasn't found its way into a release yet since things were in a bit of a freeze due to needing to put together a major release. I suspect we'll see one soon

@techalchemy
Copy link
Member

@chenull pipenv version 9.0 has been released with this fix, so I'm going to close this issue -- let us know if there is any further problem!

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