Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nosetests regreg ERROR #24

Open
xizepu opened this issue Mar 14, 2017 · 8 comments
Open

nosetests regreg ERROR #24

xizepu opened this issue Mar 14, 2017 · 8 comments

Comments

@xizepu
Copy link

xizepu commented Mar 14, 2017

Dear, My environment:

Mac OS 10.12.3
Python 2.7
Anaconda2
cython 0.25.2

and after I build and install regreg, I do nosetests regreg and there have 27 errors. the error messages are:

ERROR: Failure: ImportError (No module named projl1_cython)
Traceback (most recent call last):
File "/Users/xizepu/anaconda2/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/Users/xizepu/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Users/xizepu/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Users/xizepu/regreg/regreg/tests/test_path.py", line 1, in
import numpy as np, regreg.api as rr
File "/Users/xizepu/regreg/regreg/api.py", line 9, in
from .atoms.seminorms import (l1norm, l2norm, supnorm,
File "/Users/xizepu/regreg/regreg/atoms/seminorms.py", line 13, in
from .projl1_cython import projl1
ImportError: No module named projl1_cython

How to solve this problem? Many thanks!

@matthew-brett
Copy link
Contributor

How did you build and install regreg?
Is it possible you are running the tests from the regreg directory? If so, try running the tests from another directory, such as your home directory.

@xizepu
Copy link
Author

xizepu commented Mar 14, 2017

Dear Prof. Matthew, Many Thanks.
Firstly, I

git clone git://github.com/regreg/regreg.git

and enter regreg directory, and then

sudo python setup.py build

and in this process, there have some warnings, such as:

warning: "Using
deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by "
^
1 warning generated.
gcc -bundle -undefined dynamic_lookup -L/Users/xizepu/anaconda2/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-2.7/regreg/atoms/piecewise_linear.o -L/Users/xizepu/anaconda2/lib -o build/lib.macosx-10.7-x86_64-2.7/regreg/atoms/piecewise_linear.so

and I ignore this warning, and run

sudo python setup.py install

the output message are:

Using /Users/xizepu/anaconda2/lib/python2.7/site-packages
Finished processing dependencies for regreg==0+untagged.840.gef5533d

There are screenshot

and then I start do 'nosetests regreg'. I do two ways for this step. The first step is same as my first post, I run test at $my_home/regreg and run:

nosetests regreg

the error message show FAILED (errors=27),

and I now running the tests from another directory, such as my home directory(I use zsh):

➜ ~ pwd
/Users/xizepu

There also have 27 errors

I run tests in /Users/xizepu/regreg/regreg, and also have 27 errors.

And the main error is:

File "/Users/xizepu/regreg/regreg/atoms/seminorms.py", line 13, in
from .projl1_cython import projl1
ImportError: No module named projl1_cython

That say in $myhome/regreg/atoms/seminorms.py file, when do from .projl1_cython import proj1.

I open seminorm.py and screenshot in HERE

and open projl1_cython.pyx in directory My_Home/regreg/regreg/atoms/:

Like this

the projl1_cython.pyx

and this

Dear Prof. so many thanks for YOU!

@matthew-brett
Copy link
Contributor

So - I'd recommend you do the following:

  • remove your current installation of regreg:
cd  # cd to you your home directory
python -c 'import regreg; print(regreg.__file__)'

Delete the directory that gets printed out.

Now reinstall with pip

cd ~/regreg
git clean -fxd
pip install --user .

Then:

cd # back to your home directory
nosetests regreg

Could you post the output from that last command?

@xizepu
Copy link
Author

xizepu commented Mar 16, 2017

Many Thanks!

I removed the current installation of regreg.and reinstall with your tips.

I run pip install --user . at ~/regreg, the message are:

➜ regreg git:(master) pip install --user .
Processing /Users/xizepu/regreg
Requirement already satisfied: Cython>=0.18 in /Users/xizepu/anaconda2/lib/python2.7/site-packages (from regreg==0+untagged.840.gef5533d)
Installing collected packages: regreg
Running setup.py install for regreg ... done
Successfully installed regreg-0+untagged.840.gef5533d
➜ regreg git:(master) cd
➜ ~ python -c 'import regreg;print(regreg.file)'
/Users/xizepu/.local/lib/python2.7/site-packages/regreg/init.pyc

package regreg is installed at ~/.local/lib/python2.7/site-packages/, like

➜ site-packages pwd
/Users/xizepu/.local/lib/python2.7/site-packages
➜ site-packages tree -d
.
├── regreg
│   ├── affine
│   │   └── tests
│   ├── atoms
│   │   └── tests
│   ├── problems
│   │   └── tests
│   ├── smooth
│   │   └── tests
│   └── tests
└── regreg-0+untagged.840.gef5533d-py2.7.egg-info
11 directories

Then I cd to my home directory, and run nosetests regreg, there also have 27 errors. the error message is:

ERROR: Failure: ImportError (No module named projl1_cython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/xizepu/anaconda2/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/Users/xizepu/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Users/xizepu/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Users/xizepu/regreg/regreg/tests/test_path.py", line 1, in
import numpy as np, regreg.api as rr
File "/Users/xizepu/regreg/regreg/api.py", line 9, in
from .atoms.seminorms import (l1norm, l2norm, supnorm,
File "/Users/xizepu/regreg/regreg/atoms/seminorms.py", line 13, in
from .projl1_cython import projl1
ImportError: No module named projl1_cython

----------------------------------------------------------------------

Ran 30 tests in 0.394s
FAILED (errors=27)

Any way, this message point the error in from .projl1_cython import projl1, but when I import this in manual, NO REEOES :(
like this screenshot

by the way, when I run nosetests numpy there also have error, and nosetest pip it show OK.

Many thanks!

@matthew-brett
Copy link
Contributor

I notice that nose is still picking up the source directory of regreg:

mod = load_module(part_fqname, fh, filename, desc)
File "/Users/xizepu/regreg/regreg/tests/test_path.py", line 1, in 
import numpy as np, regreg.api as rr

I'm not sure how to explain that - but that's the reason that the tests are failing - it's trying to run the tests from the source directory.

@xizepu
Copy link
Author

xizepu commented Mar 16, 2017

Many thanks for you! Let me try in another way. Many thanks!

@matthew-brett
Copy link
Contributor

Ah - I see the problem - nosetests is interpreting regreg as a directory, and so running the tests on the source directory. Try:

mkdir tmp
cd tmp
nosetests regreg

I guess that will work.

@jonathan-taylor
Copy link
Contributor

I guess having source under regreg is sort of non-standard. Could be moved I supposed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants