To import pyplot on a remote server where you can’t install Anaconda, you can try using a virtual environment with the required packages installed. Here’s what you can do:
-
Create a virtual environment on the remote server (if you have permission to do so):
python -m venv myenv -
Activate the virtual environment:
source myenv/bin/activate -
Install
matplotlib(which includespyplot) in the virtual environment:pip install matplotlib
After these steps, try running your Python code again. It should be able to import pyplot from matplotlib.
If you don’t have permission to create a virtual environment, you might need to ask the system administrator to install matplotlib for you or provide an alternative solution.