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 molmod fails #23

Closed
wk858834 opened this issue Dec 6, 2019 · 12 comments
Closed

nosetests molmod fails #23

wk858834 opened this issue Dec 6, 2019 · 12 comments

Comments

@wk858834
Copy link
Collaborator

wk858834 commented Dec 6, 2019

Dear Toon,

when installing conda install -c conda-forge molmod
or alternativelyy conda install -c molmod tamkin nose
it keeps giving me errors like:

(KoppScience) wk858834@login18-1:~[517]$ nosetests molmod    
E
======================================================================
ERROR: Failure: ValueError (numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/wk858834/anaconda2/envs/KoppScience/lib/python3.7/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/home/wk858834/anaconda2/envs/KoppScience/lib/python3.7/site-packages/nose/loader.py", line 406, in loadTestsFromName
    module = resolve_name(addr.module)
  File "/home/wk858834/anaconda2/envs/KoppScience/lib/python3.7/site-packages/nose/util.py", line 312, in resolve_name
    module = __import__('.'.join(parts_copy))
  File "/home/wk858834/anaconda2/envs/KoppScience/lib/python3.7/site-packages/molmod/__init__.py", line 67, in <module>
    from molmod.similarity import *
  File "/home/wk858834/anaconda2/envs/KoppScience/lib/python3.7/site-packages/molmod/similarity.py", line 45, in <module>
    from molmod.ext import similarity_table_labels, similarity_table_distances, \
  File "__init__.pxd", line 918, in init molmod.ext
ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject

----------------------------------------------------------------------
Ran 1 test in 0.002s

FAILED (errors=1)

Do you have an idea what is going wrong here?

Best Regards
Wassja

@tovrstra
Copy link
Member

@wk858834 I'm sorry I missed this.

I believe this is due to an API change in NumPy compared to the NumPy version that the conda package was built with. Did you install NumPy via Pip? That is a common cause for this problem and it often happen unintantionally, e.g. when using pip to install some package that requires a newer NumPy version than the one that comes with conda.

@mefuller
Copy link
Contributor

mefuller commented Feb 27, 2020

I also encountered this error today when attempting to add Tamkin to an existing environment, but it was resolved by creating a new environment and installing Tamkin there.

(ChemEnv) [fuller@Speedy hno2_abstractions]$ nosetests -v tamkin
Failure: ValueError (numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject) ... ERROR

======================================================================
ERROR: Failure: ValueError (numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/nose/loader.py", line 406, in loadTestsFromName
    module = resolve_name(addr.module)
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/nose/util.py", line 312, in resolve_name
    module = __import__('.'.join(parts_copy))
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/tamkin/__init__.py", line 39, in <module>
    from tamkin.chemmod import *
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/tamkin/chemmod.py", line 42, in <module>
    from molmod import boltzmann, kjmol, second, meter, mol, planck
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/molmod/__init__.py", line 67, in <module>
    from molmod.similarity import *
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/molmod/similarity.py", line 45, in <module>
    from molmod.ext import similarity_table_labels, similarity_table_distances, \
  File "__init__.pxd", line 918, in init molmod.ext
ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)

In my case, numpy was definitely not installed using pip and was installed using conda. It may be that the version of numpy that was already present in the environment is incompatible with the one used to build tamkin, but shouldn't it then be the case that the version of numpy should be specified by the tamkin package? Or did a numpy update break backwards compatibility?

@tovrstra
Copy link
Member

tovrstra commented Mar 3, 2020

TAMkin itself is not the problem because it is a pure Python code. This issue is specific for cython extensions, which are used in MolMod. How did you install MolMod?

@mefuller
Copy link
Contributor

mefuller commented Mar 3, 2020 via email

@tovrstra
Copy link
Member

I tried to reproduce this, but for me it all works. These are the steps taken:

# skip the following if you already have conda
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda3.sh;
bash miniconda3.sh -b -p $HOME/miniconda3
source ~/miniconda3/bin/activate
# Actual test
conda create -n tamkin python=3.7 nose
conda activate tamkin
conda install -c molmod tamkin
nosetests -v tamkin
# clean up
conda deactivate
conda remove --name tamkin --all

One potential issue could be a mixup of a nose version installed outside conda (e.g. in ~/.local or system-wide), which will not play well with your conda environment. Could you check if that is the case? If so, it would consider adding nose as dependency of the tamkin conda package.

@mefuller
Copy link
Contributor

mefuller commented May 13, 2020

In my functioning, dedicated TAMkin environment (python 2.7), I have the following versions based on conda list:

# Name                    Version                   Build
tamkin                    1.2.4                         0
nose                      1.3.7                    py27_2 
numpy                     1.16.4           py27h7e9f1db_0  
numpy-base                1.16.4           py27hde5b4d6_0

In my other environment, where I attempted to add TAMkin, nosetests still fail and the envionment is python 3.7:

# Name                    Version                   Build
tamkin                    1.2.7                    py37_1
nose                      1.3.7                    py37_2 
numpy                     1.15.4           py37h1d66e8a_0  
numpy-base                1.15.4           py37h81de0dd_0
 $ nosetests -v tamkin

Failure: ValueError (numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject) ... ERROR

======================================================================
ERROR: Failure: ValueError (numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/nose/loader.py", line 406, in loadTestsFromName
    module = resolve_name(addr.module)
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/nose/util.py", line 312, in resolve_name
    module = __import__('.'.join(parts_copy))
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/tamkin/__init__.py", line 39, in <module>
    from tamkin.chemmod import *
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/tamkin/chemmod.py", line 42, in <module>
    from molmod import boltzmann, kjmol, second, meter, mol, planck
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/molmod/__init__.py", line 67, in <module>
    from molmod.similarity import *
  File "/home/fuller/miniconda2/envs/ChemEnv/lib/python3.7/site-packages/molmod/similarity.py", line 45, in <module>
    from molmod.ext import similarity_table_labels, similarity_table_distances, \
  File "__init__.pxd", line 918, in init molmod.ext
ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)

@tovrstra
Copy link
Member

I've modified my test procedure to better mimic your environment, switching of Miniconda2 for the base environment:

# skip the following if you already have conda
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda2.sh;
bash miniconda2.sh -b -p $HOME/miniconda2
source ~/miniconda2/bin/activate
# Actual test
conda create -y -n tamkin python=3.7 nose
conda activate tamkin
conda install -y -c molmod tamkin
nosetests -v tamkin
# clean up
conda deactivate
conda remove --name tamkin --all

This still works on my side, so I'll suggest some things that might explain the different observations:

  • Does the output of which nosetests refer to nosetests in the conda environment? In my case it gives ~/miniconda2/envs/tamkin/bin/nosetests.

  • Does your ~/.condarc contain special channels or other settings that could interfere? For this test, I have the following in ~/.condarc:

ssl_verify: true
channels:
  - defaults
  • I have newer versions of NumPy when I test this on my side (1.18.1). Does the problem persist when you upgrade all conda packages in the ChemEnv environment? E.g.
conda activate ChemEnv
conda update --all

(Such upgrades could be potentially dangerous, so to play it safe, you could also make a new conda environment to test this.)

@mefuller
Copy link
Contributor

mefuller commented May 13, 2020

  1. In both environments, which nosetests correctly gives ~/miniconda2/envs/$CONDA_ENV/bin/nosetests

  2. I do not have a .condarc

  3. I cloned my environment and attempted to make updates:
    a) No changes were made automatically to NumPy:

$ conda update --all
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/fuller/miniconda2/envs/NewChemEnv


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    dbus-1.13.14               |       hb2f20db_0         504 KB
    ipython-7.13.0             |   py37h5ca1d4c_0         991 KB
    pandas-1.0.3               |   py37h0573a6f_0         8.6 MB
    python-3.7.7               |hcf32534_0_cpython        45.0 MB
    ------------------------------------------------------------
                                           Total:        55.1 MB

The following NEW packages will be INSTALLED:

  matplotlib-base    pkgs/main/linux-64::matplotlib-base-3.1.3-py37hef1b27d_0

The following packages will be UPDATED:

  dbus                                   1.13.12-h746ee38_0 --> 1.13.14-hb2f20db_0
  glib                                    2.56.2-hd408876_0 --> 2.63.1-h5a9c865_0
  gstreamer                               1.14.0-hb31296c_0 --> 1.14.0-hb453b48_1
  ipython                              7.1.1-py37h39e3cac_0 --> 7.13.0-py37h5ca1d4c_0
  matplotlib                           2.2.2-py37hb69df0a_2 --> 3.1.3-py37_0
  pandas                              0.23.4-py37h04863e7_0 --> 1.0.3-py37h0573a6f_0

The following packages will be DOWNGRADED:

  libffi                                     3.3-he6710b0_1 --> 3.2.1-hd88cf55_4
  python                                   3.7.7-hcff3b4d_5 --> 3.7.7-hcf32534_0_cpython


Proceed ([y]/n)? 
b) A request to update numpy afterwards did nothing:
$ conda update numpy
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

$ conda list numpy
# packages in environment at /home/fuller/miniconda2/envs/NewChemEnv:
#
# Name                    Version                   Build  Channel
numpy                     1.15.4           py37h1d66e8a_0  
numpy-base                1.15.4           py37h81de0dd_0  

@tovrstra
Copy link
Member

Ok, there could be other packages preventing the upgrade of NumPy. This can be checked as follows:

conda install numpy=1.18.1

If other packages require a lower version of NumPy, this will give an error message.

@mefuller
Copy link
Contributor

mefuller commented May 13, 2020

Yes - I set up a tamkin environment with python 3 as above and that worked fine, but I ran into errors when then trying to add cantera to the environment.
Interestingly, going the other way didn't produce the same error messages - installing tamkin into an environment with cantera went fine, but nosetests then failed. and trying to force numpy to 1.18.1 produced a lot of incompatibilities.
env_conflict.txt
numpy_upgrade_conflict.txt

Output is attached in case it's of interest

@tovrstra
Copy link
Member

I see. I should update the NumPy dependency of the molmod package to be require at least version 1.16.0, which is the lowest version without this issue. This will effectively make it impossible to install it together with Cantera, alas. See e.g. GeoStat-Framework/GSTools#84 (comment)

@tovrstra
Copy link
Member

Fixed in #30

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