1

I'm trying to use the /opt/moose/miniconda/bin/python environment (an environment set up by my work) to work on some separate code and am getting an error when trying to use the nose module to run tests.

To walk back where my problem began, I received this error when running:

pip install nose

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/moose/miniconda/lib/python2.7/site-packages/nose'
Consider using the `--user` option or check the permissions.

So I then ran

pip install nose --user

The scripts nosetests and nosetests-2.7 are installed in '~/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

So I then added to my ~/.bashrc file

export PATH=$PATH:~/.local/bin

Now when I open a python interpreter in my home directory I can successfully run:

Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 13:10:39)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nose
>>> nose.main()


----------------------------------------------------------------------
Ran 0 tests in 0.002s


OK

But, when I move to the directory that I want to actually run the tests in, I get:

$ cd Documents/projects/neml
$ python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 13:10:39)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nose
>>> nose.main()

Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

Any idea why I'm getting this error, it appears that I am running the same python in both directories. This seems like an environment issue, but if it's not, please point me in the right direction. Thanks.

gdlmx
  • 6,479
  • 1
  • 21
  • 39
dylanjm
  • 2,011
  • 9
  • 21
  • Do you have to run tests via interpreter? Or can you use CLI utility? Because when you installed `nose`, the message says that `The scripts nosetests and nosetests-2.7 are installed in '~/.local/bin'` Can you try running `nosetests` command in the `Documents/projects/neml`? – bagljas Mar 14 '19 at 15:45
  • @bagljas When I run `nosetests` I get the same error. In fact, my preferred way is going to be using `nosetests` – dylanjm Mar 14 '19 at 16:00
  • I'm not on Mac, so I'm unable to simulate your problem. But it seems you are right, this might be environment related as per https://stackoverflow.com/a/38976341/7109330 and that answer links to this question https://stackoverflow.com/q/15678153/7109330 I also found this issue which might be similar to your problem https://github.com/GalSim-developers/GalSim/issues/546 – bagljas Mar 15 '19 at 08:40
  • Have you tried creating `virtualenv` and then installing `nose` within that `virtualenv`? Doing it this way, you can be sure that your libraries will work with the python interpreter you have in virtualenv. – bagljas Mar 15 '19 at 08:43
  • I think the installation is not compatible with some other packages in your anaconda environment. It's better to [clone](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#cloning-an-environment) the `conda` environment under your home folder and run `conda install nose` to install the [nose from anaconda](https://anaconda.org/anaconda/nose). – gdlmx Mar 17 '19 at 00:50
  • @dylanjm Does [this answer](https://stackoverflow.com/a/15735588/3767239) solve your problem? – a_guest Mar 17 '19 at 00:59

0 Answers0