Forums

Upgrading from python3.6.0 to python3.6.10 in virtualenv

Hi,

I've recently updated from python 3.5 to python 3.6. So i have 2 virtual environments, one for each version, and switched the webapp over no problem (selecting the new virtual env and the associated python version). Now i'm trying to use a package that requires python3.6.10. How do I make this update? Can I update my existing virtual env? Or do i need to create a new virtual environments can i just specify "mkvirtualenv myvirtualenv --python=/usr/bin/python3.6.10"? And another thing, on the web tab under Code, Python Version, i only have options up to 3.6. Is is possible to add 3.7 and 3.8?

Thanks, Eric

The most recent Python 3.6 that we have on PythonAnywhere is 3.6.9. You have a pretty old system image, which is why you do not have Python 3.7 and 3.8 available. We can update your system image for you. Note that switching to the new system image may break some of your existing code that worked on older versions. You may need to recreate any virtualenvs that you're using and you will need to start new consoles and reload your web apps. You will also need to kill any ipython notebook processes that are running by using the "Fetch processes" button on the Consoles page. Let us know if you'd like us to update your system image.

Hi Glenn,

Yes let's update the system image please. Can we schedule a time for tomorrow possibly between 9AM and 12PM PST? And I see 2 processes under "Fetch processes". One is a bash process (95% CPU) and another is mysql instance (1% CPU). So I don't have any ipython notebook processes so i should be good on that front if you can just confirm.

And once you update the system image, the steps i take are. let me know if i missed anything:

  1. mkvirtualenv myvirtualenv --python=/usr/bin/python3.6.9 or mkvirtualenv myvirtualenv --python=/usr/bin/python3.6 (do i need the 3.6.9 or just 3.6 in the command line)
  2. install all my packages again
  3. reload the webapp

OK, we will upgrade your system image later on today. The steps you described do not need a system image change though since you already have Python 3.6 -- after the upgrade you'll have more recent Python versions (as you requested). Remember to point to the right virtual environment in the Web page and to adjust Python version there.

I see ok great. Thank you very much. Cheers

We've upgraded your system image -- any new consoles you start will have the new system image; websites and scheduled tasks will pick it up the next time they're started.

Your default save and run python version and default python3 version remain unchanged. We can change it for you if you want.

Hey,

Thank you for the update, i see the new versions. I'm getting this error if you could please advice:

2021-01-27 11:58:20,670: Error running WSGI application 2021-01-27 11:58:20,678: NameError: name '_mysql' is not defined ... import MySQLdb as Database If you're seeing an import error and don't know why, ...

That looks like a broken install of MySQLdb in your virtualenv. Delete your virtualenv and rebuild it.

ok great. i think i've fixed it. thank you!

Excellent, glad we could help!