Wednesday, October 27, 2021

[SOLVED] Error while running python code on EC2 server

Issue

HI I am trying to run my python codes from EC2 server. the connection and all has been completed so that works fine. however when I try and run a code it gave me an error ImportError: No module named 'matplotlib' Tried to install matplotlib using pip install matplotlib but I get an error ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/dateutil' Consider using the `--user` option or check the permissions.


Solution

pip defaults to installing Python packages to a system directory (such as /usr/local/lib/python3.4). This requires root access.

--user makes pip install packages in your home directory instead, which doesn't require any special privileges.

reference: What is the purpose "pip install --user ..."?



Answered By - hithyshi