0

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.

1
  • you aren't allowed do sudo pip install? It works in my case Commented Dec 30, 2019 at 11:56

1 Answer 1

1

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 ..."?

Sign up to request clarification or add additional context in comments.

4 Comments

thanks @hithyshi, that was helpful. I tried downloading using sudo pip3 --user install matplotlib, but get another error File "/usr/bin/pip3", line 9, in <module> from pip import main ImportError: cannot import name 'main' any idea what's happening here?
@PrasKam try this: python3 -m pip install --user "packagename" and let me know
perfect, thanks @hithyshi, that was very helpful again. its working fine now
although one issue I just realised is that I don't see my graphs when I run it from the EC2 server. something that you are aware of?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.