0

I am trying to run my python code in my University server ( its OS is Linux)

When I try to run my code I get this error

[am333@uni-login-06 ~]$ python3 15Gadi01.py
Traceback (most recent call last):
  File "15Gadi01.py", line 1, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'

I realised that Pandas is not installed

so I tried to install Pandas

[am333@uni-login-06 ~]$ pip3 install pandas
Collecting pandas
  Using cached https://files.pythonhosted.org/packages/c3/e2/00cacecafbab071c787019f00ad84ca3185952f6bb9bca9550ed83870d4d/pandas-1.1.5-cp36-cp36m-manylinux1_x86_64.whl
Collecting numpy>=1.15.4 (from pandas)
  Using cached https://files.pythonhosted.org/packages/45/b2/6c7545bb7a38754d63048c7696804a0d947328125d81bf12beaa692c3ae3/numpy-1.19.5-cp36-cp36m-manylinux1_x86_64.whl
Collecting pytz>=2017.2 (from pandas)
  Using cached https://files.pythonhosted.org/packages/70/94/784178ca5dd892a98f113cdd923372024dc04b8d40abe77ca76b5fb90ca6/pytz-2021.1-py2.py3-none-any.whl
Collecting python-dateutil>=2.7.3 (from pandas)
  Using cached https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl
Requirement already satisfied: six>=1.5 in /half-root/usr/lib/python3.6/site-packages (from python-dateutil>=2.7.3->pandas)
Installing collected packages: numpy, pytz, python-dateutil, pandas
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 789, in install
    **kwargs
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 854, in install
    strip_file_prefix=strip_file_prefix
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files
    strip_file_prefix=strip_file_prefix,
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 287, in clobber
    ensure_dir(dest)  # common for the 'include' path
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib64/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib64/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/usr/local/lib64/python3.6'

I tried to google it

and google suggested pip install wheel first

[am333@guni-login-06 ~]$ pip3 install wheel
Collecting wheel
  Using cached https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl
Installing collected packages: wheel
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 789, in install
    **kwargs
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 854, in install
    strip_file_prefix=strip_file_prefix
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files
    strip_file_prefix=strip_file_prefix,
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 287, in clobber
    ensure_dir(dest)  # common for the 'include' path
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib64/python3.6/os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib64/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/usr/local/lib/python3.6'

I wonder is thre is a solution to this problem?

3
  • 2
    You are trying to install the package into the python directory itself. Unfortunately that path is in a read only position. I would suggest you to create a virtuall env in a non read onyl path and install what packages you want there. Commented Apr 9, 2021 at 3:53
  • Yes, it's a good idea to do all your python stuff in virtual environments. There are several venv wrappers, but you can check the py docs to get started: pip and virtual environments Commented Apr 9, 2021 at 4:09
  • 1
    See pip install failing with: OSError: [Errno 13] Permission denied on directory. The error message is different, but the solution to most directory permission problems is the same: Use a virtual environment. Commented Apr 9, 2021 at 5:18

2 Answers 2

1

I think you might wish to use the --user flag

pip3 install --user pandas

This will install pandas in your user account, instead of global python installation (which requires sudo privileges).

Read mode here

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

2 Comments

Virtualenv would be better
Agree @OneCricketeer but the question was only about installation so I havent inlcuded it
0

I found the answer

The problem is that I have to install cython and numpy first

pip3 install -v --no-binary :all: --user cython
pip3 install -v --no-binary :all: --user numpy
pip3 install -v --no-binary :all: --user pandas

1 Comment

The fix is actually adding --user... Pandas installs numpy on its own, and maybe also cython

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.