-1

Do you know how to fix the following error when I try to install cython?

PermissionError: [Errno 13] Permission denied: '/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/cython.py'

[namesurname@machine cmake-3.20.0]$ pip install Cython

Collecting Cython
  Using cached https://files.pythonhosted.org/packages/d7/04/5890b30102782a3ec9970df3c10f024298803d89624ee23cf75d09bd2548/Cython-0.29.24-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: Cython
Exception:
Traceback (most recent call last):
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/commands/install.py", line 351, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 854, in install
    strip_file_prefix=strip_file_prefix
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files
    strip_file_prefix=strip_file_prefix,
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/pip/wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:

PermissionError: [Errno 13] Permission denied: '/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/cython.py'

You are using pip version 9.0.1, however version 21.1.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

[namesurname@machine cmake-3.20.0]$ 

If not the right forum for this kind of questions, please let me know a suitable one!

limone
  • 279
  • 2
  • 9
  • 1
    https://stackoverflow.com/search?q=%5Bpip%5D+Errno+13+Permission+denied – phd Jul 22 '21 at 19:51
  • @phd: thanks a lot... I clicked on your link and it gives me a page with many options/links... which one do you refer to? – limone Jul 23 '21 at 07:39

1 Answers1

2

Use $ pip install cython --user. Even better, use a virtualenv. Never do sudo pip install

ev-br
  • 24,968
  • 9
  • 65
  • 78
  • Many thanks @ev-br! By using your suggestion I got this: [namesurname@machine ~]$ pip install cython --user Requirement already satisfied (use --upgrade to upgrade): cython in /usr/lib64/python2.7/site-packages You are using pip version 8.1.2, however version 21.1.3 is available. You should consider upgrading via the 'pip install --upgrade pip' command. – limone Jul 23 '21 at 07:40