AB-CE / abce

Agent-based computational Economics, the Python library that makes AB modelling easier
http://abce.readthedocs.io
181 stars 62 forks source link

Unable to install via pip #219

Closed RuizSerra closed 5 months ago

RuizSerra commented 5 months ago

I have been able to install abce and run the examples with pypy3, but not with pip3 (and therefore cannot use the Jupyter example).

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ conda activate abce

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ python --version
Python 3.9.17

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ pip --version
pip 10.0.0 from /Users/jaime/opt/anaconda3/envs/abce/lib/python3.9/site-packages/pip (python 3.9)

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ pip install abcEconomics
Collecting abcEconomics
  Using cached https://files.pythonhosted.org/packages/6b/d6/3215a0bb860a74ef8f67019b0876186f4286314a01076cadd20f47feb733/abcEconomics-0.9.7b2.tar.gz
    Complete output from command python setup.py egg_info:
    error in abcEconomics setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
        numpy >= 1.10.2p
              ~~~~~~~~~^

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7_/c1cv6s6x0bx0t53z73bsnxpc0000gn/T/pip-install-ud_hxc0r/abcEconomics/
You are using pip version 10.0.0, however version 23.3.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I have also tried installing from source:

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ git clone git@github.com:AB-CE/abce.git
Cloning into 'abce'...
remote: Enumerating objects: 8237, done.

remote: Counting objects: 100% (143/143), done.
remote: Compressing objects: 100% (67/67), done.
remote: Total 8237 (delta 64), reused 121 (delta 63), pack-reused 8094
Receiving objects: 100% (8237/8237), 17.91 MiB | 4.85 MiB/s, done.
Resolving deltas: 100% (5802/5802), done.

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ pip3 install ./abce
Processing ./abce
    Complete output from command python setup.py egg_info:
    /Users/jaime/opt/anaconda3/envs/abce/lib/python3.9/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
    !!

            ********************************************************************************
            Requirements should be satisfied by a PEP 517 installer.
            If you are using pip, you can try `pip install --use-pep517`.
            ********************************************************************************

    !!
      dist.fetch_build_eggs(dist.setup_requires)
    error in abcEconomics setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
        numpy >= 1.10.2p
              ~~~~~~~~~^

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7_/c1cv6s6x0bx0t53z73bsnxpc0000gn/T/pip-req-build-ws0i71ca/
You are using pip version 10.0.0, however version 23.3.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ vi abce/setup.py
### remove the 'p' in 'numpy >= 1.10.2p'

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ pip3 install ./abce
Processing ./abce
Collecting future (from abcEconomics==0.9.7b0)
  Using cached https://files.pythonhosted.org/packages/8f/2e/cf6accf7415237d6faeeebdc7832023c90e0282aa16fd3263db0eb4715ec/future-0.18.3.tar.gz
Collecting dataset==0.8 (from abcEconomics==0.9.7b0)
  Using cached https://files.pythonhosted.org/packages/83/52/06da43ea44857c137cf3c5cbd3213bc8af21df6e19096aa7b12cf6fb9325/dataset-0.8.0-py2.py3-none-any.whl
Collecting numpy>=1.10.2 (from abcEconomics==0.9.7b0)
  Using cached https://files.pythonhosted.org/packages/d0/b0/13e2b50c95bfc1d5ee04925eb5c105726c838f922d0aaddd57b7c8be0f8b/numpy-1.26.3.tar.gz
  Missing build time requirements in pyproject.toml for numpy>=1.10.2 from https://files.pythonhosted.org/packages/d0/b0/13e2b50c95bfc1d5ee04925eb5c105726c838f922d0aaddd57b7c8be0f8b/numpy-1.26.3.tar.gz#sha256=697df43e2b6310ecc9d95f05d5ef20eacc09c7c4ecc9da3f235d39e71b7da1e4 (from abcEconomics==0.9.7b0): 'wheel'.
  This version of pip does not implement PEP 517 so it cannot build a wheel without 'setuptools' and 'wheel'.
  Installing build dependencies ... done
Collecting pandas>=0.17.1 (from abcEconomics==0.9.7b0)
  Using cached https://files.pythonhosted.org/packages/03/d2/6fb05f20ee1b3961c7b283c1f8bafc6de752155d075c5db61c173de0de62/pandas-2.2.0.tar.gz
  Missing build time requirements in pyproject.toml for pandas>=0.17.1 from https://files.pythonhosted.org/packages/03/d2/6fb05f20ee1b3961c7b283c1f8bafc6de752155d075c5db61c173de0de62/pandas-2.2.0.tar.gz#sha256=30b83f7c3eb217fb4d1b494a57a2fda5444f17834f5df2de6b2ffff68dc3c8e2 (from abcEconomics==0.9.7b0): 'setuptools'.
  This version of pip does not implement PEP 517 so it cannot build a wheel without 'setuptools' and 'wheel'.
  Could not find a version that satisfies the requirement numpy<=2.0.0.dev0,>1.22.4 (from versions: )
No matching distribution found for numpy<=2.0.0.dev0,>1.22.4
You are using pip version 10.0.0, however version 23.3.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I'd really appreciate any pointers! Thank you :)

RuizSerra commented 5 months ago

Update:

After updating pip to 23.3.2, I am still unable to install from pypi:

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ pip install abcEconomics
Collecting abcEconomics
  Using cached abcEconomics-0.9.7b2.tar.gz (509 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      error in abcEconomics setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
          numpy >= 1.10.2p
                ~~~~~~~~~^
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

But I am able to install from source (after removing the 'p' from the numpy version in setup.py:

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ pip install ./abce
Processing ./abce
  Preparing metadata (setup.py) ... done
# (...)
Successfully installed Jinja2-3.1.3 Mako-1.3.1 MarkupSafe-2.1.4 PyYAML-6.0.1 abcEconomics-0.9.7b0 alembic-1.13.1 banal-1.0.6 bokeh-0.12.16 chardet-5.2.0 charset-normalizer-3.3.2 dataset-0.8.0 future-0.18.3 normality-2.5.0 numpy-1.26.3 pandas-2.2.0 pytz-2023.3.post1 sqlalchemy-2.0.25 text-unidecode-1.3 tzdata-2023.4

(abce)
jaime at Jaime-MBP in ~/Documents/PhD
$ python
Python 3.9.17 (main, Jul  5 2023, 15:35:09)
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import abcEconomics as abce
>>> exit()
rht commented 5 months ago

It means the version of the repo you cloned is not up to date. A fix had already been merged ~4 months ago https://github.com/AB-CE/abce/commit/2f51be1f6cd913b324b8045945f87de891a91761.

rht commented 5 months ago

It looks like there are several places where the 'p' suffix still exists: https://github.com/search?q=repo%3AAB-CE%2Fabce%201.10.2p&type=code. A pull request to fix this would be appreciated!

RuizSerra commented 5 months ago

Thanks @rht ! PR submitted :)

rht commented 5 months ago

Closed via #220.