How to install a Python package into Sandbox
Last updated
Was this helpful?
Last updated
Was this helpful?
Follow the instructions to load your package into FinnGen green bucket. After your package is in the green bucket follow these steps to install the Python package to your home/ivm.
If you have third-party packages and many dependencies installation from the source may get tricky. You may consider using the instead.
In sandbox open Terminal Emulator. Check that you are in /home/ivm
Copy the source code from /finngen/green to /home/ivm/. Here we will load source code for .
Extract the source code
Change directory
Check the status of installation in sandbox environment
Information about the package appear indicating that the package is installed on python2.
To uninstal Python package
Check the status on python3
No output appears indicating that the package is not installed on python3.
To install the Python package with python3 move to the folder where your package is (here /home/ivm/yhaplo-master).
Install with python3. Note that the code must be run in the package's folder where setup.py exists (here /home/ivm/yhaplo-master).
Check where the package is installed
You have to add the local installed package directory into PYTHONPATH.
There are two ways to do this:
First way is to use command line (This command needs to be run every time you open Sandbox instance)
export PYTHONPATH = $PYTHONPATH:/home/ivm/.local/lib/python3.7/site-packages
Or paste the same command into ~/.bashrc
export PYTHONPATH = "${PYTHONPATH}:/home/ivm/.local/lib/python3.7/site-packages"
and then source the file by typing the below command:
source ~/.bashrc
This way, every Sandbox instance will automatically add the PYTHONPATH
Second way is to add them in Python itself. Doing this one time is enough and it will remember the path next time you run Python or even open a new Sandbox instance. Follow the instruction below:
python3
import sys
sys.path.insert(0,'/home/ivm/.local/lib/python3.7/site-packages')
import yhalpo
Either of them will add the path and will load the installed packages.
Note: If the package is not installed it might be incompatible with other Python packages in the Sandbox. In that case, you can and load your package there.