nealde/Ampere

pip install failure

Closed this issue · 3 comments

I'm trying to install this on the Linux subsystem of WIn10 and getting an error on the pip install. Below is the command and output.

The short version is ampere/models/SPM/SPM_par.c:615:26: fatal error: SPM_par.source: No such file or directory, the longer version is below.

I'll be honest, not sure where it is even looking for the file.

| => pip3 install ampere
Collecting ampere
  Using cached https://files.pythonhosted.org/packages/5b/85/3bc85e1f206377584f7938bf6c6adcc32279fb96793f84f44d58f3333386/ampere-0.2.4.tar.gz
Requirement already satisfied: matplotlib in /usr/local/lib/python3.5/dist-packages (from ampere) (3.0.2)
Requirement already satisfied: numpy in /usr/local/lib/python3.5/dist-packages (from ampere) (1.16.0)
Requirement already satisfied: scipy in /usr/local/lib/python3.5/dist-packages (from ampere) (1.2.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.5/dist-packages (from matplotlib->ampere) (2.3.1)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.5/dist-packages (from matplotlib->ampere) (0.10.0)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.5/dist-packages (from matplotlib->ampere) (2.7.5)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.5/dist-packages (from matplotlib->ampere) (1.0.1)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from cycler>=0.10->matplotlib->ampere) (1.10.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from kiwisolver>=1.0.1->matplotlib->ampere) (20.7.0)
Building wheels for collected packages: ampere
  Building wheel for ampere (setup.py) ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-fkp9_h47/ampere/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-wemswh_m --python-tag cp35:
  ['ampere', 'ampere.models', 'ampere.tests', 'ampere.models.P2D', 'ampere.models.SPM']
  /usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  creating build/lib.linux-x86_64-3.5/ampere
  copying ampere/__init__.py -> build/lib.linux-x86_64-3.5/ampere
  copying ampere/ampere.py -> build/lib.linux-x86_64-3.5/ampere
  copying ampere/analytical.py -> build/lib.linux-x86_64-3.5/ampere
  copying ampere/fitting.py -> build/lib.linux-x86_64-3.5/ampere
  copying ampere/numerical.py -> build/lib.linux-x86_64-3.5/ampere
  copying ampere/plotting.py -> build/lib.linux-x86_64-3.5/ampere
  creating build/lib.linux-x86_64-3.5/ampere/models
  copying ampere/models/__init__.py -> build/lib.linux-x86_64-3.5/ampere/models
  creating build/lib.linux-x86_64-3.5/ampere/tests
  copying ampere/tests/__init__.py -> build/lib.linux-x86_64-3.5/ampere/tests
  creating build/lib.linux-x86_64-3.5/ampere/models/P2D
  copying ampere/models/P2D/__init__.py -> build/lib.linux-x86_64-3.5/ampere/models/P2D
  copying ampere/models/P2D/setup.py -> build/lib.linux-x86_64-3.5/ampere/models/P2D
  copying ampere/models/P2D/solve.py -> build/lib.linux-x86_64-3.5/ampere/models/P2D
  copying ampere/models/P2D/test.py -> build/lib.linux-x86_64-3.5/ampere/models/P2D
  creating build/lib.linux-x86_64-3.5/ampere/models/SPM
  copying ampere/models/SPM/__init__.py -> build/lib.linux-x86_64-3.5/ampere/models/SPM
  copying ampere/models/SPM/setup.py -> build/lib.linux-x86_64-3.5/ampere/models/SPM
  copying ampere/models/SPM/solve.py -> build/lib.linux-x86_64-3.5/ampere/models/SPM
  copying ampere/models/SPM/test.py -> build/lib.linux-x86_64-3.5/ampere/models/SPM
  running build_ext
  building 'ampere.models.SPM.SPM_par' extension
  creating build/temp.linux-x86_64-3.5
  creating build/temp.linux-x86_64-3.5/ampere
  creating build/temp.linux-x86_64-3.5/ampere/models
  creating build/temp.linux-x86_64-3.5/ampere/models/SPM
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c ampere/models/SPM/SPM_par.c -o build/temp.linux-x86_64-3.5/ampere/models/SPM/SPM_par.o
  In file included from /usr/include/numpy/ndarraytypes.h:1777:0,
                   from /usr/include/numpy/ndarrayobject.h:18,
                   from /usr/include/numpy/arrayobject.h:4,
                   from ampere/models/SPM/SPM_par.c:613:
  /usr/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   #warning "Using deprecated NumPy API, disable it by " \
    ^
  ampere/models/SPM/SPM_par.c:615:26: fatal error: SPM_par.source: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Yes, I've been trying to get the package to be pip installable, but I haven't had much luck. I've been working on other things, but will have more time for this soon. The problem right now is that not all of the source files are being sent to pip, as the C and cython files need to be compiled on the machine during installation.

Once I figure that out, it should work, but I just noticed that the cython wrapper that I made seems to only work in windows - it gives a segfault in Linux for some reason. I'll update this issue when I get these problems fixed.

In the meantime, on Windows, the package can be used by downloading from Git and navigating to the ampere/models/SPM and ampere/models/P2D folders and running the following command:
python setup.py build_ext --inplace

Once the binaries are compiled, the library works perfectly.

the most recent commit fixed the compilation error in linux, so the above method should now also work in linux. Still working on making it properly pip installable

The package is officially pip installable in both Linux and Windows, but you'll need to install Cython and Numpy first. It can handle the other dependencies.