Closed reza35 closed 6 years ago
Can you try to remove the build
directory and try python setup.py install
again? I'll remove the build directory from github later.
I cloned it again. now setup.py is located in src/ and when I go there and run python setup.py install, I get an error message like this: ... gfortran -c -ffree-line-length-none -fPIC -O3 -fno-automatic -ffast-math -funroll-loops -Dpython -cpp hazel_py.f90 running install running build running build_ext cythoning pyhazel.pyx to pyhazel.c error: [Errno 2] No such file or directory: '/scratch/reza/hazel2/hazel/src/pyhazel.pyx'
That's odd. There shouldn't be any setup.py on src/. Can you pull again the repository and check that this is indeed the case?
I did a git clone of the latest version, then setup.py install, and it worked fine. In a new terminal, I started ipython, and basically executed the example in https://aasensio.github.io/hazel2/basic.html page, and it created a nice plot.
The only comment: in the Readme file in the main branch, under "Programmatically", the example contains "j" which should not be there, simply replace it with something like this:
mod.atmospheres['ch1'].set_parameters([10.0,20.0,100.0,1.0,0.0,8.0,1.0,0.0,1.0])
Fixed.
I'm having exactly the same problem as Reza reported at the beginning with the "ImportError: No module named 'hazel.codes.sir_code'" message. I use Python 3.5.2, GCC 5.4.0 on Ubuntu 16.04.4 x86_64. The build log for "python3 setup.py install" has no errors and is here.
Is this the first you install hazel2? If not, could you have a look at /usr/local/lib/python3.5/dist-packages
and check that there is not a previous version of hazel (should be called either hazelinv or hazel). I had a problem registering hazel at pip and I had to change the name of the package to hazelinv.
Yes, this is the 1st time I install hazel2. I tried building it in several different ways by completely cleaning the repository and the contents of /usr/local/lib/python3.5/dist-packages/hazel*
.
First. The problem is gone once I make the development version (python3 setup.py develop
). I can build the default version on top (python3 setup.py install
) or even clean the repository and the contents of /usr/.../dist-packages/hazel*
and build the default version and it will work. The test four-panel case from "Basic usage - Programmatically" works.
Second. If I make a fresh clone of the repository and try to build the default version again, it throws me the same problem as I have reported before. There is something between install
and develop
that really makes the difference.
Third. Taking an advantage of the moment, could you fix the following things in the documentation?
Installation - Requirements:
configobj
instead of configobh
.tqdm
is missing.Basic usage - Programmatically:
ff
value is missing after the parameter list in the call to .set_parameters()
.UPD: I've forgotten to mention that I'm installing the code from source. I'm not using pip/conda/any environments.
Are you trying to import hazel
from the installation directory? If this is the case, this might be the cause why you are having problems with the ImportError: No module named 'hazel.codes.sir_code'
error. Try to change directory and see if it works.
Additionally, if you install using python setup.py develop
, you can uninstall the package for using later python setup.py install
by using python setup.py develop --uninstall
(or editing the easy-install.pth
file in the /usr/.../dist-packages/
directory).
I've also updated the documentation. I'm waiting for the code to be slightly more stable to upload it to pip and conda.
Just in case if somebody encounters the same issue and none of the above suggestions work, here is how I got round the problem. For some reason, installing the development version and then the normal one on top of it works:
$ python3 setup.py develop
$ python3 setup.py install
Hi, I have the problem with "import hazel" too. I'm following these suggestions, removing build directory, recloning and reinstalling but it has no effect. I tried to import from the hazel2 directory (the installation directory) and I have this error: Python 3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 23:10:56) Type 'copyright', 'credits' or 'license' for more information IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.
ModuleNotFoundError Traceback (most recent call last)
Solved for the moment. Pulled the latest version of the code, updated conda, reinstalled all packages and it works.
should I do anything regarding the SIR code to get things working? I had no warning in installation but cannot import hazel:
(rpy3) reza@debian:/data/hazel2$ ipython Python 3.4.5 | packaged by conda-forge | (default, Sep 8 2016, 14:22:44) Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details.
In [1]: import hazel
ImportError Traceback (most recent call last)