Forums

Module not found: no module named web3

Hi, I am trying to use the web3 library on your platform, however I have encountered an issue where it seems to only working when using a virtual environment.

I'm now working without virtualenv and server never goes up cause error running WSGI application: ModuleNotFoundError: No module named 'web3.

But it is searching for the module in virtualenv directory.

Anyhow, I can import correctly the Web3 library from bash console, e print its package as "/.local/"

Can you please provide clarification on whether the web3 module is only functional with a virtual environment on PythonAnywhere? Thank you in advance for your assistance

Any module on PythonAnywhere is only available in the environment where it is installed. If you installed it with --user, then it's in .local then it's available without a virtualenv, but not (generally in any virtualenv). However, if you install it in a virtualenv, then it is only available in that virtualenv. If your web app is configured to use a virtualenv, the module needs to be installed in that virtualenv. See https://help.pythonanywhere.com/pages/InstallingNewModules/