Py.test tests/unit errors

============================= test session starts ==============================
platform darwin -- Python 2.7.13, pytest-3.0.7, py-1.4.34, pluggy-0.4.0
rootdir: /Users/pegasus/Documents/nupic/nupic, inifile:
plugins: xdist-1.16.0, cov-2.5.0
collected 279 items / 49 errors 

==================================== ERRORS ====================================
_ ERROR collecting tests/unit/nupic/algorithms/anomaly_likelihood_jeff_test.py _
tests/unit/nupic/algorithms/anomaly_likelihood_jeff_test.py:35: in <module>
    from nupic.algorithms import anomaly_likelihood as an
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nupic/algorithms/__init__.py:28: in <module>
    from nupic.bindings.algorithms import svm_01, svm_dense
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nupic/bindings/algorithms.py:119: in <module>
    from nupic.proto.SpatialPoolerProto_capnp import SpatialPoolerProto
capnp/lib/capnp.pyx:3949: in capnp.lib.capnp._Loader.load_module (capnp/lib/capnp.cpp:75559)

???
.
.
.

============================ pytest-warning summary ============================
WC1 /Users/pegasus/Documents/nupic/nupic/tests/unit/nupic/support/decorators_test.py cannot collect test class 'TestParentException' because it has a __init__ constructor
WC1 /Users/pegasus/Documents/nupic/nupic/tests/unit/nupic/support/decorators_test.py cannot collect test class 'TestChildException' because it has a __init__ constructor
!!!!!!!!!!!!!!!!!!! Interrupted: 49 errors during collection !!!!!!!!!!!!!!!!!!!
================= 2 pytest-warnings, 49 error in 6.96 seconds ==================

when I run py.test tests/unit, I got this errors, by the way before I got this error, I have struggled for long time to install nupic as I always got errors ,the most frequently occured errors is :’ permission denied …'
after trying all the possible solutions on the internet, i come across this error.

please help me, thanks…

1 Like

I still don’t think you have NuPIC installed right. What were the steps you took to install, and the console output when the step(s) failed?

Hi, Taylor,
Thanks for your timely response, actually, I don’t think I installed nupic correctly, either. However, I have tried many methods got from the google and this forum.

When I use the command ‘pip install nupic --user’, I got the error:

Exception:
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/usr/local/lib/python2.7/site-packages/pip/commands/install.py”, line 342, in run
prefix=options.prefix_path,
File “/usr/local/lib/python2.7/site-packages/pip/req/req_set.py”, line 784, in install
**kwargs
File “/usr/local/lib/python2.7/site-packages/pip/req/req_install.py”, line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File “/usr/local/lib/python2.7/site-packages/pip/req/req_install.py”, line 1064, in move_wheel_files
isolated=self.isolated,
File “/usr/local/lib/python2.7/site-packages/pip/wheel.py”, line 247, in move_wheel_files
prefix=prefix,
File “/usr/local/lib/python2.7/site-packages/pip/locations.py”, line 153, in distutils_scheme
i.finalize_options()
File “/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py”, line 336, in finalize_options
self.create_home_path()
File “/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py”, line 555, in create_home_path
os.makedirs(path, 0700)
File “/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py”, line 150, in makedirs
makedirs(head, mode)
File “/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py”, line 150, in makedirs
makedirs(head, mode)
File “/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py”, line 150, in makedirs
makedirs(head, mode)
File “/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py”, line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: ‘/Users/pegasus/Library/Python/2.7’

Then add ‘sudo’, like this ‘sudo pip install nupic’.

The directory ‘/Users/pegasus/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/Users/pegasus/Library/Caches/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Requirement already satisfied: nupic in ./Documents/nupic/nupic/src
Requirement already satisfied: asteval==0.9.1 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: coverage==3.7.1 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: mock==1.0.1 in /usr/local/lib/python2.7/site-packages (from nupic)
Requirement already satisfied: ordereddict==1.1 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: psutil==1.0.1 in /usr/local/lib/python2.7/site-packages (from nupic)
Requirement already satisfied: pytest==3.0.7 in /usr/local/lib/python2.7/site-packages (from nupic)
Requirement already satisfied: pytest-cov==2.5.0 in /usr/local/lib/python2.7/site-packages (from nupic)
Requirement already satisfied: pytest-xdist==1.16.0 in /usr/local/lib/python2.7/site-packages (from nupic)
Requirement already satisfied: python-dateutil==2.1 in /usr/local/lib/python2.7/site-packages (from nupic)
Requirement already satisfied: PyYAML==3.10 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: unittest2==0.5.1 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: validictory==0.9.1 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: PyMySQL==0.6.2 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: DBUtils==1.1 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: pyproj==1.9.3 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: prettytable==0.7.2 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: nupic.bindings==0.7.2 in ./Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: numpy==1.12.1 in /usr/local/lib/python2.7/site-packages (from nupic)
Requirement already satisfied: pycapnp==0.5.12 in /usr/local/lib/python2.7/site-packages (from nupic)
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/site-packages (from pytest==3.0.7->nupic)
Requirement already satisfied: py>=1.4.29 in /usr/local/lib/python2.7/site-packages (from pytest==3.0.7->nupic)
Requirement already satisfied: execnet>=1.1 in /usr/local/lib/python2.7/site-packages (from pytest-xdist==1.16.0->nupic)
Requirement already satisfied: six in ./Library/Python/2.7/lib/python/site-packages (from python-dateutil==2.1->nupic)
Requirement already satisfied: apipkg>=1.4 in /usr/local/lib/python2.7/site-packages (from execnet>=1.1->pytest-xdist==1.16.0->nupic)

For this first time, I was so happy that I tried tests ‘py.test tests/unit errors’. Unfortunately. the error occured like illustrated above.

I tried other methods, but none of these possible solutions suits mine.

Do you have the right pip version as described here?

Hi, Taylor, thanks for your patience :smile: . Yes, I have got the right pip version (9.01)

python version is 2.7.13 and My MacOS is Sierra version 10.12.4 I don’t know if this matters.

one more thing, in my OS, there is also python 3.6, but I don’t think this will arise some conflicts.

Actually, our team focuses on htm recently which is thought as a very promising algorithm, nevertheless, no one installed nupic successfully. we all use macOS.

We will appreciate it if you kindly offer us a painless installing way. For now, we are all going crazy…:sob:

That’s not good! We all use macOS too. Usually pip install nupic --user works.

Yes, I have watched many your videos on youtube, and I notice that you use MacOS. But is there any thing we could do as this is not an incident-- we all get crashed?

This seems like a permission problem. Can you try uninstalling nupic completely? Then run pip install nupic --user and paste the complete console output in a gist.

Thanks for your kindly continuously attention. I applied a ‘tough’ method: install nupic in another Mac, which worked except 6 tests error. But this is all right as it is in my ‘receptive field’.
Thanks…