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

mp conflict when using a virtualenv #1106

Closed
fawkesley opened this issue Nov 19, 2014 · 3 comments
Closed

mp conflict when using a virtualenv #1106

fawkesley opened this issue Nov 19, 2014 · 3 comments

Comments

@fawkesley
Copy link
Contributor

So I did:

mkvirtualenv -p $(which python2) mailpile && workon mailpile
pip install -r requirements.txt
./mp

But because the hashbang in mp is #!/usr/bin/env python2 - and virtualenv only intercepts python - mp tries to run with my system python2 environment, which has no packages installed. Thus I get this error:

ImportError: No module named jinja2

I'm not really sure if this is mailpile's fault for specifying python2 in the hashbang or virtualenv's fault for not intercepting python2 ...

The workaround is to use: python mp which will ensure you're in the virtualenv.

Maybe the "fix" to this issue is for the docs to recommend python mp rather than ./mp?

What's your view on this folks?

@avanheuvelen
Copy link
Contributor

I'm running mailpile in a virtualenv as well, but this issue doesn't apply to me. My viritualenv does seem to load python2. Maybe this is fixed in a newer version of virtualenv?

I'm running arch with virtualenv2 version 1.11.6

@fawkesley
Copy link
Contributor Author

I'm on virtualenv 1.7.1.2 from the python-virtualenv deb on Ubuntu 12.04. I don't have a virtualenv2 command.

@avanheuvelen Can you activate a virtualenv and confirm the output of which python and which python2? Mine shown below:

$ which python
/home/paul/.virtualenvs/mailpile/bin/python
$ which python2
/usr/bin/python2

Looks like this probably is a older virtualenv issue (couldn't find any reference to it though). Awkward, as Ubuntu 12.04 LTS has got a lot of life left in it yet!

@fawkesley
Copy link
Contributor Author

For anyone encountering the same problem, I decided to wipe the ubuntu provided packages and install with pip as user. Re-creating the virtualenv resolved the issue:

$ rmvirtualenv mailpile
$ sudo apt-get remove python-virtualenv virtualenvwrapper
$ pip install --user virtualenv virtualenvwrapper
$ mkvirtualenv mailpile
$ which python
/home/paul/.virtualenvs/mailpile/bin/python
$ which python2
/home/paul/.virtualenvs/mailpile/bin/python2  # yay

I think we probably all agree that this issue is with virtualenv, so I'm closing this one.

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

2 participants