2

How can we run python scripts implementing pandas module in the environment where pandas is not installed?

For example, on a server we don't have permission to install python modules. We have a script which is using the pandas module, so how can we run those scripts?

sophros
  • 14,672
  • 11
  • 46
  • 75
Vijay
  • 75
  • 4
  • Can't you just install the library with pip ? – ikibir Feb 26 '20 at 10:08
  • Add more context, Where are you trying to run the script? Are you using Docker? – prp Feb 26 '20 at 10:14
  • @ikibir: I don't have access to install module and use pip within VDI. – Vijay Feb 26 '20 at 10:16
  • @prp: i'm trying to run the script on unix server on which pandas is not installed. is there any way to run the python scripts by with out installing python modules? – Vijay Feb 26 '20 at 10:18
  • Most python environment allow 2 groups of additional packages: one is common to all users, but there is another one per user. The key is to intall the required packages with `pip install --user ...` – Serge Ballesta Feb 26 '20 at 10:19

1 Answers1

0

In short: no, you can't. You have to install the package.

There are at least two options. First, you can install the packages that are not in the system to your home dir (but this is messy and dependent on the changes to the OS-level setup). You use:

pip install --user pandas 

However, a better way is to use virtual environment (e.g. venv):

python -m venv local-env

In this way you can create a local copy of Python environment in which you can install pandas and any other dependencies of your code. And it is fully under your control.

On venv you can read more in the Python documentation.

sophros
  • 14,672
  • 11
  • 46
  • 75