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

Feature request: python virtualenvs #43

Closed
stellarhoof opened this issue Dec 10, 2018 · 6 comments
Closed

Feature request: python virtualenvs #43

stellarhoof opened this issue Dec 10, 2018 · 6 comments

Comments

@stellarhoof
Copy link

stellarhoof commented Dec 10, 2018

When providing the full python executable I would expect sys.path to be set as:

$ .venv/bin/python -m pdb foo.py
$ (Pdb) import sys
$ (Pdb) sys.path
['', '/Users/berserk/Source/ocean/.venv/lib/python36.zip', '/Users/berserk/Source/ocean/.venv/lib/python3.6', '/Users/berserk/Source/ocean/.venv/lib/python3.6/lib-dynload', '/nix/store/mb1fwxr8w1n16fww8bp8spy6xy5dbjhm-python3-3.6.6-env/lib/python3.6', '/Users/berserk/Source/ocean/.venv/lib/python3.6/site-packages']

Whereas in :exe 'GdbStartPDB '.expand('%:p:h').'/.venv/bin/python -m pdb '.expand('%'), sys.path is equal to that of $ python -m pdb foo.py.

Might be the cause of #42, since my virtualenv's python is 3 and my system's python is 2.

@sakhnik
Copy link
Owner

sakhnik commented Dec 11, 2018

That's strange. Technically, the python interpreter is spawned with execlp, which behaves similarly to the shell. If the full path is specified, that specific executable should be launched. And I can't reproduce your issue, sorry.

@stellarhoof
Copy link
Author

To reproduce:

  1. Make a new pipenv project with PIPENV_VENV_IN_PROJECT=1
  2. Install a library not present in your system's python
  3. Import it from a file and try to debug that

@sakhnik
Copy link
Owner

sakhnik commented Dec 12, 2018

I've never worked with pipenv. Could you please give me a detailed list of specific commands just like for a dummy? For example:

  • cd /tmp; mkdir proj && cd proj
  • PIPENV_VENV_IN_PROJECT=1 pipenv <whatever>
  • ...

@stellarhoof
Copy link
Author

Pipenv integrates virtualenv and python dependency tracking. If you have a python project with a requirements.txt, pipenv will pick that up automatically on pipenv install. PIPENV_VENV_IN_PROJECT=1 makes it so that it will create the virutal environment folder in the project's directory. You just have to git clone any python repo and pipenv install inside. I hope this clarifies.

@sakhnik
Copy link
Owner

sakhnik commented Dec 29, 2018

I'm afraid, I still can't reproduce the issue. I installed python 2.7.15 into ~/.pyenv and test/pyenv, and both work as expected. It must be something specific to your OS.
https://asciinema.org/a/218897

@gzbd
Copy link

gzbd commented Jul 25, 2019

Hi,

Sorry for commenting on a closed issue, but to use pipenv generated virtualenv in your project simply run the GDBStartPDB command like:
:GDBStartPDB pipenv run python -m pdb main.py

and your modules from virtualenv will be importable in debugging session :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants