nbro
nbro

Reputation: 15857

How to upgrade yolk to yolk3k in a virtual env?

I have just started using virtualenv from this tutorial, where it uses yolk to list the packages installed in the virtualenv, but yolk by default is for Python 2, so I decided to upgrade with an extension for Python 3, my current version, with the following command:

pip3 install --upgrade yolk3k

It works when I am not in the virtualenv that I called virt0, but if I am on it, it gives me the error it was giving me before upgrading it to the Python 3 version.

    print " %s %s (%s)" % (project_name, dist.version,
                      ^
SyntaxError: invalid syntax

When I tried to install yolk in the virt0, the output was the following:

Searching for yolk
Best match: yolk 0.4.3
Processing yolk-0.4.3-py3.4.egg
yolk 0.4.3 is already the active version in easy-install.pth
Installing yolk script to /Users/user/Desktop/virt_env/virt0/bin

Using /Users/user/Desktop/virt_env/virt0/lib/python3.4/site-packages/yolk-0.4.3-py3.4.egg
Processing dependencies for yolk
Finished processing dependencies for yolk

In /Users/user/Desktop/virt_env/virt0/bin, I have this:

activate            pip3
activate.csh        pip3.4
activate.fish       python
activate_this.py    python3
easy_install        python3.4
easy_install-3.4    yolk
pip

which confirms that yolk was installed, but how can I update it also to yolk3k in virt0?

If I try to install yolk3k with the following command:

pip3 install --upgrade yolk3k

inside /Users/user/Desktop/virt_env/virt0/bin, it outputs:

Requirement already up-to-date: yolk3k in /Users/user/Desktop/virt_env/virt0/lib/python3.4/site-packages

but it still gives me the error I cited above.

Upvotes: 1

Views: 711

Answers (1)

Simeon Visser
Simeon Visser

Reputation: 122456

Delete the virtualenv, recreate it with Python 3 as the interpreter and install all dependencies for Python 3 (such as yolk3k). The problem seems to come from the fact that you're going from a 2.x to a 3.x environment even though the virtualenv originally wasn't.

That's not the intended way of using a virtualenv - a virtualenv should be tied to one particular Python version (e.g., 2.7 or 3.4) with all dependencies installed for that version. So you should throw away the virtualenv and rebuild it entirely using 3.x dependencies. That should resolve any conflicting language issues.

Upvotes: 2

Related Questions