0

I want to run python scripts on a remote server. I put my code under a directory using FileZilla, and I connect to the server using PuTTY. When I run my scripts, I have a ModuleNotFound error because I didn't install packages on the remote server. However, I'm not allowed to do a pip install on the server.

So I thought about using a virtual environment to manage it. But how can I export the virtual environment on the remote server?

Or is there a better way to manage it?

Thank you

Martin Prikryl
  • 167,268
  • 50
  • 405
  • 846
rkhan
  • 155
  • 2
  • 12
  • Depending on the type of the modules you might not be able to just copy the environment. The best way is to recreate it from `requirements.txt`. If you don't have proper shell access, the server might not be suitable for a Python deployment. – Klaus D. Jul 04 '21 at 19:45

1 Answers1

2

use this command on cmd of you computer

pip3 freeze > requirements.txt

then copy the file the virtual remote directory the open cmd in virtual remote

cd C://< where you copied the file>
pip install -r requirements.txt

or you can use this suggestion https://stackoverflow.com/a/31684470/16270009