-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Pipenv unable to install relative path that is a subdirectory of a Pipfile #4900
Comments
This could be a possible duplicate of #4895 but with a slightly different setup |
@PythonCoderAS I noticed you are trying with an older version of pipenv, could you check again with |
Nope still doesn't work |
@PythonCoderAS It worked just fine for me ... what is the difference here?
|
@matteius the thing is that you specified a path from the root directory. You have to change the working directory to the subdirectory and then use a relative path from said subdirectory. |
This is because this Line 132 in 29af360
You may argue that is not reasonable to cd to the project root. But that line has been there for 4 years and there is likely someone relying on this behavior, who knows. |
Maybe a fallback can be tried where if resolution fails on the root directory it |
The resolution goes too deep from the project initialization, and it is run in a subprocess. I think it is much easier to change your workflow to using a path relative to the project root, like what @matteius does. |
I don't really understand the use case of changing to the directory to issue the pipenv command, because the virtualenv is based off the working directory and that is also where its going to look for the Pipfile and Pipfile.lock, right? I mean it seems odd to not reference from the root project into the relative path of the editable thing you wish to install. I also might not quite understand how the line @frostming linked to is related to this behavior, because the actual error when I try it as @PythonCoderAS does, is that it cannot parse the requirements, unless you are saying it changed directories to the root because it detected the Pipfile was a directory higher, in which case there was no setup.py there. I tried to copy the Pipfile and Pipfile.lock into the sphynx directory and ran the command the way @PythonCoderAS but it still failed though (not sure why). |
@matteius Yes, the root directory doesn't contain a |
This is correct. I ran into this bug solely by mistake because I had accidentally created a Pipfile in a parent directory which contained my projects. |
@frostming That makes sense, thanks. I was getting tripped up because I moved my generated Pipfile and Pipfile.lock down a directory into the sphinx and tried running
I then removed the Pipfile and Pipfile.lock and tried again, it worked from that directory. It seems that once the editable dependency is added into the lock file, it doesn't get updated by changing the path.
|
@PythonCoderAS are we in agreement that its not a bug, can I close this issue without complaints? |
I was thinking that the error was too cryptic and could be phrased better, such as "Pipenv does not support installing relative paths from subdirectories of projects." |
@PythonCoderAS I agree the actual error message is somewhat cryptic because it says I am not quite sure I understand yet the duplication of vendor packages within pipenv, but I wonder if this wouldn't be a better issue to report to: https://github.com/sarugaku/requirementslib/issues Maybe @frostming can provide guidance since he already commented on this issue and has context. One of my goals is to help this project manage its backlog of issues better, and I don't want to just turn away issues in doing so but if we can put them where it makes sense and close ones that are duplicates or won't be fixed, that seems ideal to me. |
@matteius I agree with you but unfortunately, I don't have the bandwidth in fixing bugs in either Pipenv or vendored packages. requirementslib does too many things, which makes it hard to make improvements. |
@PythonCoderAS please see frostming's last comment. If this is an important improvement to you, please open the issue with the requirementslib backlog and consider what the change would look like by proposing a PR. I am closing this issue for now since a workaround exists and the error is technically sufficient (though vague). I would think any improvements to requirementslib should first be made and proven out there first, and that having duplicated code vendor code checked into pipenv should be re-evaluated over time. Going to do a diff of latest requirements lib with latest pipenv vendor requirements lib to see if I can learn more about what's going on there, why we would not just reference the external package, as education for myself. |
Let's track this issue in: #5490 |
Issue description
Pipenv will fail to install a relative path that is a subdirectory of a directory with a Pipfile.
Expected result
Installation to succeed.
Actual result
A resolution error is returned.
Steps to replicate
pipenv install
git clone https://github.com/sphinx-doc/sphinx.git
pipenv install .
orpipenv install -e .
$ pipenv --support
Pipenv version:
'2021.5.29'
Pipenv location:
'/usr/local/lib/python3.8/site-packages/pipenv'
Python location:
'/usr/local/opt/[email protected]/bin/python3.8'
Python installations found:
3.9.9
:/usr/local/bin/python3
3.9.9
:/usr/local/bin/python3.9
3.8.2
:/usr/bin/python3
2.7.16
:/usr/bin/python2
2.7.16
:/usr/bin/python2.7
PEP 508 Information:
System environment variables:
TERM_SESSION_ID
SSH_AUTH_SOCK
LC_TERMINAL_VERSION
COLORFGBG
ITERM_PROFILE
XPC_FLAGS
LANG
PWD
SHELL
__CFBundleIdentifier
TERM_PROGRAM_VERSION
TERM_PROGRAM
PATH
DISPLAY
LC_TERMINAL
COLORTERM
COMMAND_MODE
TERM
HOME
TMPDIR
USER
XPC_SERVICE_NAME
LOGNAME
ITERM_SESSION_ID
__CF_USER_TEXT_ENCODING
SHLVL
OLDPWD
P9K_TTY
VIRTUAL_ENV_DISABLE_PROMPT
PIPENV_VERBOSITY
LDFLAGS
CPPFLAGS
EDITOR
ZSH
PAGER
LESS
LSCOLORS
P9K_SSH
MANPATH
_
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONDONTWRITEBYTECODE
PIP_SHIMS_BASE_MODULE
PIP_PYTHON_PATH
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_VERBOSITY
:-1
Debug–specific environment variables:
PATH
:/usr/local/opt/ruby/bin:/usr/local/sbin:Users/aoyansarkar/.cargo/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Applications/Little Snitch.app/Contents/Components:/opt/X11/bin:/Library/Apple/usr/bin:/Users/aoyansarkar/.oh-my-zsh/custom/plugins/git-extra-commands/bin:/usr/local/opt/fzf/bin
SHELL
:/bin/zsh
EDITOR
:vim
LANG
:en_US.UTF-8
PWD
:/Volumes/RAMDisk/praw
Contents of
Pipfile
('/Volumes/RAMDisk/Pipfile'):Contents of
Pipfile.lock
('/Volumes/RAMDisk/Pipfile.lock'):The text was updated successfully, but these errors were encountered: