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.

TRex
  • 445
  • 5
  • 14

1 Answers1

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

hithyshi
  • 713
  • 1
  • 5
  • 11
  • 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 from pip import main ImportError: cannot import name 'main'``` any idea what's happening here? – TRex Dec 30 '19 at 11:43
  • @PrasKam try this: python3 -m pip install --user "packagename" and let me know – hithyshi Dec 30 '19 at 11:57
  • perfect, thanks @hithyshi, that was very helpful again. its working fine now – TRex Dec 30 '19 at 12:13
  • 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? – TRex Dec 30 '19 at 12:15