theochem / horton

HORTON: Helpful Open-source Research TOol for N-fermion systems
http://theochem.github.io/horton/
GNU General Public License v3.0
92 stars 40 forks source link

Cannot install horton #280

Closed PeaWagon closed 6 years ago

PeaWagon commented 6 years ago

Hi guys,

I am trying to install horton on my computer (ubuntu 16.04). I am using a python 2.7 anaconda environment. However, I get an error when I try to import horton. Here is my install output:

(py27) jgarne01@oryx:~/ExtraDrive/githubcode/horton$ ./setup.py install
PLATFORM=Linux-4.4.0-93-generic-x86_64-with-debian-stretch-sid
LIBXC Configuration
   File setup.cfg not found. Skipping.
   From environment variables
      -
   Static lib config in ${QAWORKDIR}
      extra_objects: ['qaworkdir/cached/libxc-3.0.0/lib/libxc.a']
      include_dirs: ['qaworkdir/cached/libxc-3.0.0/include']
   Final
      extra_objects: ['qaworkdir/cached/libxc-3.0.0/lib/libxc.a']
      include_dirs: ['qaworkdir/cached/libxc-3.0.0/include']
LIBINT2 Configuration
   File setup.cfg not found. Skipping.
   From environment variables
      -
   Static lib config in ${QAWORKDIR}
      extra_objects: ['qaworkdir/cached/libint-2.0.3/lib/libint2.a']
      include_dirs: ['qaworkdir/cached/libint-2.0.3/include/libint2']
   Final
      extra_objects: ['qaworkdir/cached/libint-2.0.3/lib/libint2.a']
      include_dirs: ['qaworkdir/cached/libint-2.0.3/include/libint2']
Version of dependencies:
             breathe: -- not found --
            coverage: /bin/sh: 1: coverage: not found
            cppcheck: -- not found --
                curl: curl 7.52.1 (x86_64-pc-linux-gnu) libcurl/7.52.1 OpenSSL/1.0.2l zlib/1.2.8
              cython: Cython version 0.25.2
            docutils: 0.13.1
             doxygen: -- not found --
                 gcc: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
                 git: git version 2.7.4
           gitpython: -- not found --
                h5py: 2.7.0
          matplotlib: 2.0.2
                nose: nosetests version 1.3.7
               numpy: 1.12.1
                 pip: pip 9.0.1 from /home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages (python 2.7)
         pycodestyle: -- not found --
          pydocstyle: -- not found --
              pylint: pylint 1.6.4,     astroid 1.4.9
              python: Python 2.7.13 :: Anaconda 4.4.0 (64-bit)
               scipy: 0.19.0
              sphinx: Sphinx (sphinx-build) 1.5.6
    sphinx_rtd_theme: -- not found --
               sympy: 1.0

Here is the error that I get when I try to import horton:

(py27) jgarne01@oryx:~/ExtraDrive/githubcode$ python
Python 2.7.13 |Anaconda 4.4.0 (64-bit)| (default, Dec 20 2016, 23:09:15) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
`>>> import horton
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/__init__.py", line 28, in <module>
from horton.cext import *
ImportError: /home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/cext.so: 
undefined symbol: _ZTINSt8ios_base7failureB5cxx11E
`>>> 

Any help is appreciated.

Thanks, Jen

tovrstra commented 6 years ago

Could this be the same issue as reported here: lucasb-eyer/pydensecrf#28. If yes, the solution would be to install libgcc in conda:

conda install libgcc

There could be other reasons for this, so please let us know if it worked. Mixing up conda compilers with the ones from your Linux distribution is often a source of confusion.

PeaWagon commented 6 years ago

Okay I think that worked for the conda version. Thanks.

I'm still trying to get the github version to work though. When I try to import horton from the github repository that I forked, I get the following error:

(py27) jgarne01@oryx:~/ExtraDrive/githubcode/horton$ python
Python 2.7.13 |Anaconda custom (64-bit)| (default, Dec 20 2016, 23:09:15) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import horton
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "horton/__init__.py", line 28, in <module>
    from horton.cext import *
ImportError: No module named cext

When I try to import horton anywhere else, it works. This version of horton is listed in my "conda list".

horton                    2.1.0                     <pip>

Here are the tests that I ran using nosetests:

======================================================================
ERROR: horton.part.test.test_proatomdb.test_compute_radii
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/part/test/test_proatomdb.py", line 128, in test_compute_radii
    record = padb.get_record(6, 0)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/part/proatomdb.py", line 358, in get_record
    return self._map[(number, charge)]
KeyError: (6, 0)

======================================================================
ERROR: horton.part.test.test_proatomdb.test_get_spline
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/part/test/test_proatomdb.py", line 172, in test_get_spline
    spline = padb.get_spline(6)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/part/proatomdb.py", line 597, in get_spline
    rho, deriv = self.get_rho(number, parameters, combine, do_deriv=True)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/part/proatomdb.py", line 547, in get_rho
    record = self.get_record(number, charge)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/part/proatomdb.py", line 358, in get_record
    return self._map[(number, charge)]
KeyError: (6, 0)

======================================================================
FAIL: horton.part.test.test_proatomdb.test_db_basics
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/part/test/test_proatomdb.py", line 32, in test_db_basics
    assert padb.get_numbers() == [1, 8]
AssertionError

======================================================================
FAIL: horton.part.test.test_proatomdb.test_io_group
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/part/test/test_proatomdb.py", line 103, in test_io_group
    assert padb1.size == 5
AssertionError

======================================================================
FAIL: horton.part.test.test_proatomdb.test_io_filename
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/part/test/test_proatomdb.py", line 116, in test_io_filename
    assert keys == [(1, 0), (6, 0), (6, 1)]
AssertionError

======================================================================
FAIL: horton.scripts.test.test_atomdb.test_plot_atoms
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/scripts/test/test_atomdb.py", line 209, in test_plot_atoms
    check_files(dn, fns)
  File "/home/jgarne01/anaconda3/envs/py27/lib/python2.7/site-packages/horton/scripts/test/common.py", line 39, in check_files
    assert os.path.isfile(os.path.join(dn, fn)), "Missing %s" % fn
AssertionError: Missing dens_001__h.png

----------------------------------------------------------------------
Ran 979 tests in 205.954s

FAILED (SKIP=1, errors=2, failures=4)
tovrstra commented 6 years ago

You need to take the step explained here, in case you work with the version from git: http://theochem.github.io/horton/2.1.0/tech_dev_git.html#reference-atoms

Also, when you just get the version from git, the c extensions still have to be built, just like when you install from source. This is why you get the error ImportError: No module named cext. You either do a complete install of the git version (and uninstall the other version first) or you can do an in-place build with ./setup.py build_ext -i. Also keep in mind that the current latest version from git works with libxc-3.0.0.

In any case, I would strongly recommend to work only with one version of HORTON at a time on your system. Having two versions, like you do now, may give you a lot of confusion error messages.

PeaWagon commented 6 years ago

Okay, I have removed all of the versions of horton and just installed the github version. I can import horton from anywhere except the horton github directory (in that case, it gives the ImportError: No module named cext). What is the expected behaviour when importing from the horton directory? Should it work or do I have to something extra?

PeaWagon commented 6 years ago

Never mind my last comment. It seems that when I installed horton without the user argument it put my files in the correct anaconda environment directory. You can close this issue now if you'd like.

tovrstra commented 6 years ago

Both observations seem to be the normal behavior. (i) When you import a package in Python, it will first look for that package in the current directory, which in this case does not work because the cext.so file is not there. (ii) The --user option should indeed not be used when you want to install into conda or virtualenv.