0

Is it possible in a Python script to reference a folder where the libraries are located? Example: pandas, plotly, numpy, etc.

In my work there is a network block that does not allow the installation of external libraries, so I downloaded the libraries on my computer at home and brought it to work thinking that there is some way to reference the imports of my libraries through this folder as done in RStudio with .libPath. If possible, how could do this?

Image in the Folder libraries:

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Deforceh
  • 11
  • 3
  • You need to download the wheel of tar.gz format of the libraries, then do `pip install pandas.whl`, – azro Dec 23 '22 at 13:13
  • But in this case, as I don't have access to installing external libraries, it is not possible to do this because I need to update the pip version, but for that it would have to be with libraries in a folder, I believe – Deforceh Dec 23 '22 at 13:29
  • I think this topic can helps you: https://stackoverflow.com/questions/11091623/how-to-install-packages-offline – João Paulo Carvalho Dec 23 '22 at 14:01

2 Answers2

0
  1. On a computer with internet do pip download pip pandas numpy plotly
  2. You have one file per packages, and its dependencies
  3. Copy the files on the non-internet computer
  4. Run pip install * * being only all the files you downloaded
azro
  • 53,056
  • 7
  • 34
  • 70
  • in this way? pip install \\sad154000\Corporativo\Gepej\#NOVA_ESTRUTURA\Estagiarios\PythonLibrary OBS: this is the path where there is a folder of all libraries inside the "Python Library" – Deforceh Dec 23 '22 at 13:39
  • @Deforceh doesn't matter where the files are, just do `pip install pandas...whl` Also read about virtualenv to avoi setting glogal packages https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/ – azro Dec 23 '22 at 13:40
  • I added image in the question to see the libraries that I saved in folder, for this path above. Note: if I give the command: pip install ** pandas.whl it gives the following warning: [notice] A new release of pip available: 22.2.1 -> 22.3.1 [notice] To update, run: python.exe -m pip install --upgrade pip – Deforceh Dec 23 '22 at 13:45
  • @Deforceh we don't care about the warning, we don't need the latest pip version. Also please use english here – azro Dec 23 '22 at 13:46
  • but after running the command "pip install **pandas.whl" it does nothing but this pip update warning – Deforceh Dec 23 '22 at 13:49
  • @Deforceh You need to use the file names given by the download, regarding you screenshot it may be `pip install pandas.rar`, look again my post : download the files, call "pip install" on them – azro Dec 23 '22 at 13:58
  • but the pandas.rar file is in a folder with different paths, so would need to tell the code where this library is, wouldn't you? OBS: I already use venv as a virtual environment to install these libraries – Deforceh Dec 23 '22 at 14:10
  • @Deforceh pip install it somewhere, THEN python know where it is, because pip installed it – azro Dec 23 '22 at 16:29
  • @azo imgur.com/pKgh5xA – Deforceh Dec 24 '22 at 02:06
0

You can use the sys.path from the sys library in python.

You can download the library and add the path in the python script:

import sys

sys.path.append("/path_to/downloaded_librarie")

import downloaded_librarie
rzz
  • 77
  • 6