Kyle I
Kyle I

Reputation: 23

Can I install virtualenv in a different version of python?

I have ubuntu 18.04, python 3.6.5, and python 3.7.

When I run:

mkvirtualenv -p /usr/bin/python3.7 api_server

I get this:

Running virtualenv with interpreter /usr/bin/python3.7
Using base prefix '/usr'
/home/kyle/.local/lib/python3.6/site-packages/virtualenv.py:1041: DeprecationWarning:
the imp module is deprecated in favour of importlib; see the module's
documentation for alternative uses

I want to code in python3.7 but the package virtualenv is in python3.6. Can I continue to create virtual environments using virtualenv in my python3.6 directory or should I install it in python 3.7 too?

Upvotes: 2

Views: 71

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1121884

It's just a warning. You can ignore it. virtualenv works just fine with Python 3.7.

In a future version of Python, the imp module may be gone. But that time has yet to come, and the virtualenv project will have updated their code before that point.

It's notable that the virtualenv project has been aware of this issue since Python 3.4, and the imp module is still around in 3.7. There is no timeline set for the module being removed at this time, so there is no real hurry. The original tracker entry that discusses the removal hints at removal in Python 4, but that's not really set in stone either.

Upvotes: 2

Related Questions