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

ValueError: cannot set WRITEABLE flag to True of this array #977

Closed
cradesto opened this issue Nov 11, 2019 · 14 comments
Closed

ValueError: cannot set WRITEABLE flag to True of this array #977

cradesto opened this issue Nov 11, 2019 · 14 comments

Comments

@cradesto
Copy link

Problem description

We are trying to install TARDIS from the scratch following the description on
https://tardis-sn.github.io/tardis/installation.html

After that we are trying to run example notebook
docs/models/examples/run_simple_example.ipynb

And we fall into the error
ValueError: cannot set WRITEABLE flag to True of this array
on step 3:
#TARDIS now uses the data in the data repo
sim = run_tardis('tardis_example.yml')

We are thinking that this error is connected with this issue
pandas-dev/pandas#24839
But we cannot either downgrade numpy version
or upgrade pytables version as recommended on the page
pandas-dev/pandas#24839.

@chvogl
Copy link
Contributor

chvogl commented Nov 11, 2019

The same problem occurs for @manolis07gr (see #976).

@manolis07gr
Copy link

Hi @chvogl - sounds good. I am also here with the same issue as the one described by @cradesto. Thank you for looking into it - we are excited to get your help.

@chvogl
Copy link
Contributor

chvogl commented Nov 11, 2019

What are the versions of numpy and pytables that you are using @cradesto, @manolis07gr?

@manolis07gr
Copy link

@chvogl I am using 1.17.4 for NumPy and 3.4.4 for Tables:

print(numpy.version)
1.17.4
print(tables.version)
3.4.4

@chvogl
Copy link
Contributor

chvogl commented Nov 11, 2019

@manolis07gr, as suggested by @cradesto you might try to downgrade numpy. I currently use 1.15.4 (conda install numpy=1.15.4) and the same version of pytables as you.

@manolis07gr
Copy link

@chvogl just did but I get a new error now:
Traceback (most recent call last):
File "example.py", line 6, in
sim = run_tardis('tardis_example.yml')
File "/anaconda3/envs/tardis/lib/python3.6/site-packages/tardis_sn-3.0.dev3356-py3.6-macosx-10.9-x86_64.egg/tardis/base.py", line 24, in run_tardis
from tardis.simulation import Simulation
File "/anaconda3/envs/tardis/lib/python3.6/site-packages/tardis_sn-3.0.dev3356-py3.6-macosx-10.9-x86_64.egg/tardis/simulation/init.py", line 1, in
from tardis.simulation.base import Simulation
File "/anaconda3/envs/tardis/lib/python3.6/site-packages/tardis_sn-3.0.dev3356-py3.6-macosx-10.9-x86_64.egg/tardis/simulation/base.py", line 8, in
from tardis.montecarlo import MontecarloRunner
File "/anaconda3/envs/tardis/lib/python3.6/site-packages/tardis_sn-3.0.dev3356-py3.6-macosx-10.9-x86_64.egg/tardis/montecarlo/init.py", line 1, in
from tardis.montecarlo.base import *
File "/anaconda3/envs/tardis/lib/python3.6/site-packages/tardis_sn-3.0.dev3356-py3.6-macosx-10.9-x86_64.egg/tardis/montecarlo/base.py", line 13, in
from tardis.montecarlo import montecarlo, packet_source
File "init.pxd", line 918, in init tardis.montecarlo.montecarlo
ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject

@chvogl
Copy link
Contributor

chvogl commented Nov 11, 2019

There a numerous issues that deal with this problem e.g. scikit-learn-contrib/hdbscan#272. Upgrading to numpy=1.16.1 might solve the problem.

@chvogl
Copy link
Contributor

chvogl commented Nov 11, 2019

It might also be a good idea to redo the TARDIS installation (since the problem seems to occur in compiled cython code). Use git clean -dfx to remove all compiled files and rerun python setup.py install.

@GeronimoChen
Copy link

I remember I used this command to solve the problem, referring to (pandas-dev/pandas#24839 (comment)):

pip install -e git+https://github.com/PyTables/PyTables@492ee2f#egg=tables

I am not sure whether this problem depends on OS, because I was installing tardis on both my laptop (ubuntu 19.10) and a supercomputer (centos), and the compatible pandas/numpy seems to be different.
Also, my environment (on ubuntu 19.10) is like this:

name: tardis
channels:

  • conda-forge
  • defaults
    dependencies:
  • _libgcc_mutex=0.1=main
  • alabaster=0.7.12=py_0
  • asn1crypto=0.24.0=py36_1003
  • astropy=3.2.1=py36h516909a_0
  • atomicwrites=1.3.0=py_0
  • attrs=19.1.0=py_0
  • babel=2.7.0=py_0
  • backcall=0.1.0=py_0
  • blas=1.1=openblas
  • bleach=3.1.0=py_0
  • blosc=1.17.0=he1b5a44_0
  • boost-cpp=1.66.0=1
  • bzip2=1.0.8=h516909a_0
  • ca-certificates=2019.6.16=hecc5488_0
  • cairo=1.16.0=h18b612c_1001
  • certifi=2019.6.16=py36_1
  • cffi=1.12.3=py36h8022711_0
  • chardet=3.0.4=py36_1003
  • codecov=2.0.15=py_1
  • commonmark=0.9.0=py_0
  • coverage=4.5.4=py36h516909a_0
  • cryptography=2.7=py36h72c5cf5_0
  • cycler=0.10.0=py_1
  • cython=0.29.13=py36he1b5a44_0
  • dbus=1.13.6=he372182_0
  • decorator=4.4.0=py_0
  • defusedxml=0.5.0=py_1
  • docopt=0.6.2=py_1
  • docutils=0.15.2=py36_0
  • entrypoints=0.3=py36_1000
  • expat=2.2.5=he1b5a44_1003
  • fontconfig=2.13.1=he4413a7_1000
  • freetype=2.10.0=he983fc9_1
  • future=0.17.1=py36_1000
  • gettext=0.19.8.1=hc5be6a0_1002
  • git-lfs=2.8.0=0
  • glib=2.58.3=h6f030ca_1002
  • graphite2=1.3.13=hf484d3e_1000
  • graphviz=2.38.0=hf68f40c_1011
  • gst-plugins-base=1.14.5=h0935bb2_0
  • gstreamer=1.14.5=h36ae1b5_0
  • h5py=2.8.0=py36h470a237_0
  • harfbuzz=2.4.0=h37c48d4_1
  • hdf5=1.10.1=2
  • icu=58.2=hf484d3e_1000
  • idna=2.8=py36_1000
  • imagesize=1.1.0=py_0
  • importlib_metadata=0.18=py36_0
  • ipykernel=5.1.2=py36h5ca1d4c_0
  • ipython=7.7.0=py36h5ca1d4c_0
  • ipython_genutils=0.2.0=py_1
  • ipywidgets=7.5.1=py_0
  • jedi=0.15.1=py36_0
  • jinja2=2.10.1=py_0
  • jpeg=9c=h14c3975_1001
  • jsonschema=3.0.2=py36_0
  • jupyter=1.0.0=py_2
  • jupyter_client=5.3.1=py_0
  • jupyter_console=6.0.0=py_0
  • jupyter_core=4.4.0=py_0
  • kiwisolver=1.1.0=py36hc9558a2_0
  • latexcodec=1.0.7=py_0
  • libblas=3.8.0=12_openblas
  • libcblas=3.8.0=12_openblas
  • libffi=3.2.1=he1b5a44_1006
  • libgcc=7.2.0=h69d50b8_2
  • libgcc-ng=9.1.0=hdf63c60_0
  • libgfortran=3.0.0=1
  • libgfortran-ng=7.3.0=hdf63c60_0
  • libiconv=1.15=h516909a_1005
  • liblapack=3.8.0=12_openblas
  • libopenblas=0.3.7=h6e990d7_1
  • libpng=1.6.37=hed695b0_0
  • libsodium=1.0.17=h516909a_0
  • libstdcxx-ng=9.1.0=hdf63c60_0
  • libtiff=4.0.10=h57b8799_1003
  • libtool=2.4.6=h14c3975_1002
  • libuuid=2.32.1=h14c3975_1000
  • libxcb=1.13=h14c3975_1002
  • libxml2=2.9.9=h13577e0_2
  • llvmlite=0.28.0=py36hdbcaa40_0
  • lz4-c=1.8.3=he1b5a44_1001
  • lzo=2.10=h14c3975_1000
  • markupsafe=1.1.1=py36h14c3975_0
  • matplotlib=3.1.1=py36_0
  • matplotlib-base=3.1.1=py36hfd891ef_0
  • mistune=0.8.4=py36h14c3975_1000
  • moab=4.9.1=3
  • more-itertools=7.2.0=py_0
  • mpi=1.0=mpich
  • mpich=3.2.1=hc99cbb1_1014
  • nbconvert=5.6.0=py_0
  • nbformat=4.4.0=py_1
  • nbsphinx=0.4.2=py_0
  • ncurses=6.1=hf484d3e_1002
  • networkx=2.3=py_0
  • notebook=6.0.0=py36_0
  • numba=0.43.1=py36hf2d7682_0
  • numexpr=2.7.0=py36hb3f55d8_0
  • numpydoc=0.9.1=py_0
  • openblas=0.2.20=8
  • openssl=1.1.1c=h516909a_0
  • oset=0.1.3=py_1
  • packaging=19.0=py_0
  • pandas=0.24.2=py36hb3f55d8_0
  • pandoc=2.7.3=0
  • pandocfilters=1.4.2=py_1
  • pango=1.40.14=he7ab937_1005
  • parso=0.5.1=py_0
  • pbr=5.4.2=py_0
  • pcre=8.41=hf484d3e_1003
  • pexpect=4.7.0=py36_0
  • pickleshare=0.7.5=py36_1000
  • pip=19.2.2=py36_0
  • pixman=0.38.0=h516909a_1003
  • pluggy=0.12.0=py_0
  • prometheus_client=0.7.1=py_0
  • prompt_toolkit=2.0.9=py_0
  • psutil=5.6.3=py36h516909a_0
  • pthread-stubs=0.4=h14c3975_1001
  • ptyprocess=0.6.0=py_1001
  • py=1.8.0=py_0
  • pybtex=0.22.2=py36_0
  • pybtex-docutils=0.2.1=py36_1000
  • pycparser=2.19=py36_1
  • pygments=2.4.2=py_0
  • pygraphviz=1.5=py36h516909a_1001
  • pyne=0.5.11=py36_blas_openblas_0
  • pyopenssl=19.0.0=py36_0
  • pyparsing=2.4.2=py_0
  • pyqt=5.9.2=py36hcca6a23_2
  • pyrsistent=0.15.4=py36h516909a_0
  • pysocks=1.7.0=py36_0
  • pytest=5.1.0=py36_0
  • pytest-arraydiff=0.3=py_0
  • pytest-astropy=0.5.0=py_0
  • pytest-cov=2.7.1=py_0
  • pytest-doctestplus=0.3.0=py_0
  • pytest-html=1.22.0=py_0
  • pytest-metadata=1.8.0=py_0
  • pytest-openfiles=0.4.0=py_0
  • pytest-remotedata=0.3.1=py_0
  • python=3.6.7=h357f687_1005
  • python-dateutil=2.8.0=py_0
  • pytz=2019.2=py_0
  • pyyaml=5.1.2=py36h516909a_0
  • pyzmq=18.0.2=py36h1768529_2
  • qt=5.9.7=h52cfd70_2
  • qtconsole=4.5.3=py_0
  • readline=8.0=hf8c457e_0
  • recommonmark=0.6.0=py_0
  • requests=2.22.0=py36_1
  • scipy=1.1.0=py36_blas_openblash7943236_201
  • send2trash=1.5.0=py_0
  • setuptools=41.0.1=py36_0
  • sip=4.19.8=py36hf484d3e_1000
  • six=1.12.0=py36_1000
  • snowballstemmer=1.9.0=py_0
  • sphinx=2.1.2=py_0
  • sphinx_bootstrap_theme=0.6.4=py_0
  • sphinx_rtd_theme=0.4.3=py_0
  • sphinxcontrib-apidoc=0.3.0=py_1
  • sphinxcontrib-applehelp=1.0.1=py_0
  • sphinxcontrib-bibtex=0.4.2=py_0
  • sphinxcontrib-devhelp=1.0.1=py_0
  • sphinxcontrib-htmlhelp=1.0.2=py_0
  • sphinxcontrib-jsmath=1.0.1=py_0
  • sphinxcontrib-qthelp=1.0.2=py_0
  • sphinxcontrib-serializinghtml=1.1.1=py_0
  • sqlite=3.29.0=hcee41ef_0
  • terminado=0.8.2=py36_0
  • testpath=0.4.2=py_1001
  • tk=8.6.9=hed695b0_1002
  • tornado=6.0.3=py36h516909a_0
  • tqdm=4.33.0=py_0
  • traitlets=4.3.2=py36_1000
  • urllib3=1.25.3=py36_0
  • wcwidth=0.1.7=py_1
  • webencodings=0.5.1=py_1
  • wheel=0.33.4=py36_0
  • widgetsnbextension=3.5.1=py36_0
  • xorg-kbproto=1.0.7=h14c3975_1002
  • xorg-libice=1.0.10=h516909a_0
  • xorg-libsm=1.2.3=h84519dc_1000
  • xorg-libx11=1.6.8=h516909a_0
  • xorg-libxau=1.0.9=h14c3975_0
  • xorg-libxdmcp=1.1.3=h516909a_0
  • xorg-libxext=1.3.4=h516909a_0
  • xorg-libxpm=3.5.12=h14c3975_1002
  • xorg-libxrender=0.9.10=h516909a_1002
  • xorg-libxt=1.1.5=h516909a_1003
  • xorg-renderproto=0.11.1=h14c3975_1002
  • xorg-xextproto=7.3.0=h14c3975_1002
  • xorg-xproto=7.0.31=h14c3975_1007
  • xz=5.2.4=h14c3975_1001
  • yaml=0.1.7=h14c3975_1001
  • zeromq=4.3.2=he1b5a44_2
  • zipp=0.5.2=py_0
  • zlib=1.2.11=h516909a_1005
  • zstd=1.4.0=h3b9ef0a_0
  • pip:
    • bqplot==0.12.0
    • numpy==1.16.0
    • tardis-sn==3.0.dev3354
    • traittypes==0.2.1
      prefix: /home/gesa/anaconda3/envs/tardis

@manolis07gr
Copy link

Hi @chvogl, I now get a new error:

Traceback (most recent call last):
File "example.py", line 1, in
from tardis import run_tardis
File "/anaconda3/envs/tardis/lib/python3.6/site-packages/tardis_sn-3.0.dev3357-py3.6-macosx-10.9-x86_64.egg/tardis/init.py", line 11, in
from tardis.io.util import yaml_load_config_file as yaml_load
File "/anaconda3/envs/tardis/lib/python3.6/site-packages/tardis_sn-3.0.dev3357-py3.6-macosx-10.9-x86_64.egg/tardis/io/init.py", line 2, in
from tardis.io.model_reader import read_simple_ascii_density, read_simple_ascii_abundances, read_density_file
File "/anaconda3/envs/tardis/lib/python3.6/site-packages/tardis_sn-3.0.dev3357-py3.6-macosx-10.9-x86_64.egg/tardis/io/model_reader.py", line 8, in
from pyne import nucname
ImportError: cannot import name 'nucname'

@chvogl
Copy link
Contributor

chvogl commented Nov 12, 2019

@manolis07gr, could you please run
from tardis.montecarlo import montecarlo, packet_source
to make sure that the numpy problem does not occur anymore.
What is the pyne version you are using?

@manolis07gr
Copy link

@chvogl - I managed to reinstall pyne and numba on my conda tardis environment and things now run smoothly for this quickstart test - thank you so much for your patience and help! I am sure I may be reaching out again soon when I try to run my own application. Thanks again.

@chvogl
Copy link
Contributor

chvogl commented Nov 12, 2019

@manolis07gr, that is great. Happy to help!

@wkerzendorf
Copy link
Member

@cradesto download the newest environment file - it should now work.

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

No branches or pull requests

6 participants