Forums

Virtualenv Python Version - 'engines'?

I started a new web app with Python 3.5. I also made a virtualenv with Python 3.5:

(scim-py35) 16:16 ~ $ which python
/home/(user)/.virtualenvs/scim-py35/bin/python
(scim-py35) 16:16 ~ $ python --version
Python 3.5.1

But when I try to set up the virtualenv under Web / virtualenv, I get the error:

This virtualenv seems to have the wrong Python version (engines instead of 3.5).

What am I doing wrong?

I don't think you're doing anything wrong -- it looks like a bug in our virtualenv Python version detection code. The fix looks trivial, let me see if I can patch it...

OK, could you try again now?

Thanks. I now get a different failure mode.

I removed the virtualenv path, reloaded the site, added it, reloaded. I don't get the python version error, but up top I get:

There is a problem with your virtualenv setup. Look at the virtualenv section below for details.

But there's no error shown under the VirtualEnv heading; the path looks correct.

When I click on "Start a console in this virtualenv", I get:

bash: /tmp/conda: No such file or directory
18:19 ~ $ which python
/usr/bin/python
18:20 ~ $ python --version
Python 2.7.6
18:21 ~ $

So, the virtualenv didn't start in this console. Actually, now I can't get my virtualenv (which was working before!) to work in a fresh console... I guess I'll start again from scratch. I'm glad I made a requirements file!

How did you create the original virtualenv? Even if you fix it after re-creating, it would be useful to know how to repro the problem.

It looks like things fail if I

pip install conda

and then install some packages with conda.

If I stick with pip, it seems to work.

OK, thanks for letting us know. Can you enter the virtualenv by starting a Bash console and then running its activate script? That is, is it only the "Bash console in this virtualenv" link on the "Web" tab that's broken?

Here's what I have found: if a make a new virtualenv, and then do

pip install conda

and then install something with conda, e.g.

conda install numba

I am no longer able to access that virtual environment:

$ workon py35-test Error: could not find environment: py35-test

That looks like a general problem with virtualenvwrapper and conda rather than a PythonAnywhere thing -- I just reproduced the problem on my local machine.

You might be able to find workarounds based on this conda bug...?

I can live without conda for now-