How to import numpy as standard user from server?

I installed python, numpy, scipy as super user in server and I can import them without any errors. However, standard users (who connect with ssh) can not import them. How to fix it so that standard users can import them?

Thanks.

2 Answers

this sounds like your $PATH isn't pointing to those executables.

try running the following as root and then as as user

echo $PATH
which python
echo $PYTHONPATH

this will tell you which python installation you are using and where it is looking for installed python files.

It sounds like your user accounts are not pointing at the same python setup. Its best with python to only use root to update the system packages as most distros require specific python versions for some of their internal tools.

Have a look at Virtualenv installations for your user accounts , this way you can have a custom setup for each user that will not conflict, its also easier to migrate that user to other machines as the python setup will be entirely in its homedir.

2

I am assuming that since you are running Ubuntu, your standard users' OS has Python installed or that the users can install Python if it is not already installed. Add the import paths for numpy and scipy on the server at the beginning of your Python script,

import sys
sys.path.append("/path/to/numpy")
import numpy
sys.path.append("/path/to/scipy")
import scipy
3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like