numpy is not installed with Python2.

J

justin

My university has a cluster computer, on which I want to run my python
program that uses numpy.
I am installing my Python2.7 locally separated from the main system,
and trying to install numpy, attach it with Python2.7.
I used many different versions of numpys to make it happen, but I got
stuck with the same following error on every trial,

"[hp6@login1 numpy]$ python2.7 setup.py install
Running from numpy source directory.Traceback (most recent call last):
File "setup.py", line 210, in <module>
setup_package()
File "setup.py", line 187, in setup_package
from numpy.distutils.core import setup
File "/users/hp6/DOWN/numpy/numpy/distutils/core.py", line 25, in
<module>
from numpy.distutils.command import config, config_compiler, \
File "/users/hp6/DOWN/numpy/numpy/distutils/command/build_ext.py",
line 9, in <module>
from distutils.command.build_ext import build_ext as old_build_ext
File "/users/hp6/apps/python27/lib/python2.7/distutils/command/
build_ext.py", line 13, in <module>
from site import USER_BASE, USER_SITE
ImportError: cannot import name USER_BASE"

It seems the error is related to the inability of Python2.7 to process
"from site import USER_BASE, USER_SITE",
since the machine I succeeded to install numpy with Python2.7 doesn't
prompt an error from this command,
whereas this machine in which I failed to do so cannot handle this.

My question is:
How can I make Python2.7 to process this, since the manual says this
package is the one that's automatically turned on in startup.

Thanks,
Justin.
 
R

Robert Kern

My university has a cluster computer, on which I want to run my python
program that uses numpy.
I am installing my Python2.7 locally separated from the main system,
and trying to install numpy, attach it with Python2.7.
I used many different versions of numpys to make it happen, but I got
stuck with the same following error on every trial,

"[hp6@login1 numpy]$ python2.7 setup.py install
Running from numpy source directory.Traceback (most recent call last):
File "setup.py", line 210, in<module>
setup_package()
File "setup.py", line 187, in setup_package
from numpy.distutils.core import setup
File "/users/hp6/DOWN/numpy/numpy/distutils/core.py", line 25, in
<module>
from numpy.distutils.command import config, config_compiler, \
File "/users/hp6/DOWN/numpy/numpy/distutils/command/build_ext.py",
line 9, in<module>
from distutils.command.build_ext import build_ext as old_build_ext
File "/users/hp6/apps/python27/lib/python2.7/distutils/command/
build_ext.py", line 13, in<module>
from site import USER_BASE, USER_SITE
ImportError: cannot import name USER_BASE"

It seems the error is related to the inability of Python2.7 to process
"from site import USER_BASE, USER_SITE",
since the machine I succeeded to install numpy with Python2.7 doesn't
prompt an error from this command,
whereas this machine in which I failed to do so cannot handle this.

Your Python installation appears to be broken. Find the site.py module that you
are actually importing. I.e. from the numpy source directory:

$ python2.7 -c "import site; print site.__file__"

This will tell you the site.pyc file that actually gets imported. Find the
associated site.py file (it should be in the same directory) and check to see if
it has USER_BASE defined. The filename should be

/users/hp6/apps/python27/lib/python2.7/site.pyc

If it isn't, that may be the source of your problem.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
J

justin

My university has a cluster computer, on which I want to run my python
program that uses numpy.
I am installing my Python2.7 locally separated from the main system,
and trying to install numpy, attach it with Python2.7.
I used many different versions of numpys to make it happen, but I got
stuck with the same following error on every trial,
"[hp6@login1 numpy]$ python2.7 setup.py install
Running from numpy source directory.Traceback (most recent call last):
   File "setup.py", line 210, in<module>
     setup_package()
   File "setup.py", line 187, in setup_package
     from numpy.distutils.core import setup
   File "/users/hp6/DOWN/numpy/numpy/distutils/core.py", line 25, in
<module>
     from numpy.distutils.command import config, config_compiler, \
   File "/users/hp6/DOWN/numpy/numpy/distutils/command/build_ext.py",
line 9, in<module>
     from distutils.command.build_ext import build_ext as old_build_ext
   File "/users/hp6/apps/python27/lib/python2.7/distutils/command/
build_ext.py", line 13, in<module>
     from site import USER_BASE, USER_SITE
ImportError: cannot import name USER_BASE"
It seems the error is related to the inability of Python2.7 to process
"from site import USER_BASE, USER_SITE",
since the machine I succeeded to install numpy with Python2.7 doesn't
prompt an error from this command,
whereas this machine in which I failed to do so cannot handle this.

Your Python installation appears to be broken. Find the site.py module that you
are actually importing. I.e. from the numpy source directory:

   $ python2.7 -c "import site; print site.__file__"

This will tell you the site.pyc file that actually gets imported. Find the
associated site.py file (it should be in the same directory) and check to see if
it has USER_BASE defined. The filename should be

   /users/hp6/apps/python27/lib/python2.7/site.pyc

If it isn't, that may be the source of your problem.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

Dear Kern,

Thanks a lot.
Your quick and detailed comment saves me a lot of time and effort
now.

It seems the file path links are out of order as you diagnosed.
Like you said, there is a site.py on /users/hp6/apps/python27/lib/
python2.7/.
But when I typed in "$ python2.7 -c "import site; print
site.__file__", it refers to another place:
"/opt/apps/gurobi/3.0.0/linux64/lib/python2.5/site.pyc", and it
doesn't have USER_BASE!

So I changed the value of PYTHONPATH accordingly.

Thanks again,
Justin.
 
R

Robert Kern

My university has a cluster computer, on which I want to run my python
program that uses numpy.
I am installing my Python2.7 locally separated from the main system,
and trying to install numpy, attach it with Python2.7.
I used many different versions of numpys to make it happen, but I got
stuck with the same following error on every trial,
"[hp6@login1 numpy]$ python2.7 setup.py install
Running from numpy source directory.Traceback (most recent call last):
File "setup.py", line 210, in<module>
setup_package()
File "setup.py", line 187, in setup_package
from numpy.distutils.core import setup
File "/users/hp6/DOWN/numpy/numpy/distutils/core.py", line 25, in
<module>
from numpy.distutils.command import config, config_compiler, \
File "/users/hp6/DOWN/numpy/numpy/distutils/command/build_ext.py",
line 9, in<module>
from distutils.command.build_ext import build_ext as old_build_ext
File "/users/hp6/apps/python27/lib/python2.7/distutils/command/
build_ext.py", line 13, in<module>
from site import USER_BASE, USER_SITE
ImportError: cannot import name USER_BASE"
It seems the error is related to the inability of Python2.7 to process
"from site import USER_BASE, USER_SITE",
since the machine I succeeded to install numpy with Python2.7 doesn't
prompt an error from this command,
whereas this machine in which I failed to do so cannot handle this.

Your Python installation appears to be broken. Find the site.py module that you
are actually importing. I.e. from the numpy source directory:

$ python2.7 -c "import site; print site.__file__"

This will tell you the site.pyc file that actually gets imported. Find the
associated site.py file (it should be in the same directory) and check to see if
it has USER_BASE defined. The filename should be

/users/hp6/apps/python27/lib/python2.7/site.pyc

If it isn't, that may be the source of your problem.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Dear Kern,

Thanks a lot.
Your quick and detailed comment saves me a lot of time and effort
now.

It seems the file path links are out of order as you diagnosed.
Like you said, there is a site.py on /users/hp6/apps/python27/lib/
python2.7/.
But when I typed in "$ python2.7 -c "import site; print
site.__file__", it refers to another place:
"/opt/apps/gurobi/3.0.0/linux64/lib/python2.5/site.pyc", and it
doesn't have USER_BASE!

So I changed the value of PYTHONPATH accordingly.

You should not set PYTHONPATH to those directories ever. The correct one will
already be on the sys.path. In a multiple-Python environment, you simply
shouldn't use PYTHONPATH at all since all of the interpreters will try to use it.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top