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

ERROR: Your setuptools version is too old (<12) #43

Open
ricbencar opened this issue Jun 17, 2019 · 16 comments
Open

ERROR: Your setuptools version is too old (<12) #43

ricbencar opened this issue Jun 17, 2019 · 16 comments

Comments

@ricbencar
Copy link

The command "python setup.py bdist_wheel -d dist" produces "ERROR: Your setuptools version is too old (<12)". Yet, the installed setuptools version is 41.0.1, as seen below. Please help!

linux@linux:/MODELOS/wafo/pywafo-master > python setup.py bdist_wheel -d dist
Traceback (most recent call last):
File "setup.py", line 110, in
setup_package_pyscaffold()
File "setup.py", line 106, in setup_package_pyscaffold
**config.todict())
File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/usr/local/lib/python2.7/dist-packages/setuptools/init.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.7/dist-packages/numpy/distutils/numpy_distribution.py", line 16, in init
Distribution.init(self, attrs)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 444, in init
k: v for k, v in attrs.items()
File "/usr/lib/python2.7/distutils/dist.py", line 287, in init
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 732, in finalize_options
ep.load()(self, ep.name, value)
File "/home/linux/MODELOS/wafo/pywafo-master/.eggs/pyscaffold-2.4.4-py2.7.egg/pyscaffold/integration.py", line 105, in pyscaffold_keyword
check_setuptools_version()
File "/home/linux/MODELOS/wafo/pywafo-master/.eggs/pyscaffold-2.4.4-py2.7.egg/pyscaffold/utils.py", line 210, in check_setuptools_version
"ERROR: Your setuptools version is too old (<12).\n"
RuntimeError: ERROR: Your setuptools version is too old (<12).
Use pip install -U setuptools to upgrade.
linux@linux:
/MODELOS/wafo/pywafo-master > python setup.py bdist_wheel -d dist > out.txt
Traceback (most recent call last):
File "setup.py", line 110, in
setup_package_pyscaffold()
File "setup.py", line 106, in setup_package_pyscaffold
**config.todict())
File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/usr/local/lib/python2.7/dist-packages/setuptools/init.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.7/dist-packages/numpy/distutils/numpy_distribution.py", line 16, in init
Distribution.init(self, attrs)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 444, in init
k: v for k, v in attrs.items()
File "/usr/lib/python2.7/distutils/dist.py", line 287, in init
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 732, in finalize_options
ep.load()(self, ep.name, value)
File "/home/linux/MODELOS/wafo/pywafo-master/.eggs/pyscaffold-2.4.4-py2.7.egg/pyscaffold/integration.py", line 105, in pyscaffold_keyword
check_setuptools_version()
File "/home/linux/MODELOS/wafo/pywafo-master/.eggs/pyscaffold-2.4.4-py2.7.egg/pyscaffold/utils.py", line 210, in check_setuptools_version
"ERROR: Your setuptools version is too old (<12).\n"
RuntimeError: ERROR: Your setuptools version is too old (<12).
Use pip install -U setuptools to upgrade.

linux@linux:~/MODELOS/wafo/pywafo-master > easy_install --version
setuptools 41.0.1 from /usr/local/lib/python2.7/dist-packages (Python 2.7)

@g-freire
Copy link

Same issue here

@acoat
Copy link

acoat commented Jul 15, 2019

Hi
I succeed in building the wafo 0.3.1 package by using the following conda environnement:

conda install -y -n pywafo2 -y -c conda-forge python=2.7 "setuptools_scm<2.0" "pbr=1.10" 'pyscaffold>=2.4rc1,<2.5a0' "scipy>=0.9" matplotlib numpy "numdifftools>=0.2" mpmath "numba<0.44" "setuptools<39" fortran-compiler pytest pytest-cov

@Slagstad
Copy link

Hi,
I am having the same problem on a windows 10 operating system. I am using python 3.7 and anaconda distribution. Will I be able to install Wafo?

@JohnCHarrington
Copy link

@Slagstad this package uses Python 2.7, so you will NOT be able to use it with 3.7. You can either set up a conda environment that uses Python 2.7 as above, or try using a Python 3 version of this repo, e.g. my one here: available.

The downside of this of course is that I cannot guarantee any of the functionality as I do not update that repo and have not tested it beyond the few bits I actually use, but if it's useful to you then you are welcome to try it.

@morbult
Copy link
Contributor

morbult commented Apr 11, 2020

Hi all,

This package IS Python 3 compatible as well. Some time ago I got it to work to build for Python 3.6 using (I think) old versions of pyscaffold and setuptools, but I recently ran into problems after updating to Python 3.7 and I could not get an environment working with those old versions. Luckily I found a way of building it again which I have done for Python 3.6, 3.7 and 3.8. Here is what worked for me.

Install a Fortran compiler and C++ Build Tools (e.g. from here and here) and download a copy of this repo. Use Anaconda3 and create a new environment (example for Python 3.7)

conda create -n wafobuild37
conda activate wafobuild37
conda install anaconda python=3.7

(This gives me setuptools 46.1.3 btw). The next step would be to run python setup.py bdist_wheel, but that results in the error described above:
RuntimeError: ERROR: Your setuptools version is too old (<12).

In setup.py, remove the upper version bound for pyscaffold, like so 'pyscaffold>=2.4rc1' instead of 'pyscaffold>=2.4rc1,<2.5a0'. Be sure to remove the hidden .eggs folder if you got it from earlier tries since it may contain an old version of pyscaffold.

Running python setup.py bdist_wheel now results in a new error:
LookupError: setuptools-scm was unable to detect version for 'C:\...\pywafo-master'

This was (for some reason I don't understand) solved by copying the PKG-INFO file from the wafo 0.3.1 release on pypi to the same folder as setup.py. So download this wafo release, extract the tarball and copy the PKG-INFO file.

Now build with python setup.py bdist_wheel

I always have to run this 3 times before the wheel is created in the dist folder. It seems different .mod files are not found after the first and second time.

Install with pip install dist\wafo-0.3.1-cp37-cp37m-win_amd64.whl

Other notes

  • You also need numdifftools to import wafo, pip install numdifftools
  • scipy 1.0.0 or later causes ImportError since functions have moved within scipy. I made two pull requests to fix it, here and here. Fix this in your own copy before you build if necessary.
  • The Fortran extensions mvn, mvnprdmod, rindmod and cov2mod were not compiled correctly for me, so if you want to use them I'm not sure it will work. If I try to import them (e.g. import wafo.mvn) they all give ImportError: DLL load failed while importing mvn: The specified module could not be found. The C extension c_library did compile and the few functions I use from it seem to work fine regardless of the Python version I build for.

@rscorrea1
Copy link

rscorrea1 commented Apr 12, 2020

@morbult thank you for the detailed explanation!
I followed it with one difference: I have created my virtual enviroment using the venv module python -m venv using Python 3.7.5.

I did install the Fortran compiler and C++ Build Tools you mentioned. After running python setup.py bdist_wheel -d dist i get the following error: error: library _mvnprdmod has Fortran sources but no Fortran compiler found and a folder called build is created.

Now I dont know how to make the Fortran compiler and C++ Build Tools to be used during the installation. I tried to check the setup.py but i cannot see where to specify them. Can you help me?

Thank you!

@morbult
Copy link
Contributor

morbult commented Apr 12, 2020

@rscorrea1 you're welcome!
I have never used python -m venv but I guess that is not the problem for you. It seems the Fortran compiler was not installed or is missing from your PATH environment variable. I tried to run the installtion again and realized that in one of the dialogs you have to check the box Components/gcc/fortran since it is unchecked by default. Do that and check that you have the file gfortran.exe under C:\TDM-GCC-64\bin or wherever you installed. Also add C:\TDM-GCC-64\bin to PATH if it is not there already.

@rscorrea1
Copy link

rscorrea1 commented Apr 13, 2020

@morbult Your explanation is pretty accurate!
I was finally able to install pywafo. Thank you again!

If I run the tutorial scripts (Chapter 1 - Estimation of spectrum) I face issues like TypeError: 'numpy.float64' object cannot be interpreted as an integer which is basically related to my numpy version. Obviously I can debug each problem applying int() to all variables that is currently of type numpy.float64 and expected to be integer in some of the numpy methods.

Another issue which is related to pylab and/or matplotlib. the method stineman_interp is deprecated and the following import erros is raised: ImportError: cannot import name 'stineman_interp' from 'pylab'.

if you want to try to reproduce the aforementioned errors you can run the Section 1.4.1 Simulation from spectrum, Estimation of spectrum here (Jupyter notbook field [7]).

If you are not facing that issue, could you share which numpy and matplotlib versions you are using?

Again, many thanks!

@morbult
Copy link
Contributor

morbult commented Apr 13, 2020

That's great!

Regarding your new problems, I think you should create a new issue since they don't relate to this issue about setuptools. Include sample code to reproduce the errors. I don't think I will be able to help you though. I don't manage this package and don't know a whole lot about it really. The few functions I use relate to rainflow cycle counting and they work fine.

I use numpy 1.18.1 and matplotlib 3.1.3 in my recent builds but I have used older versions before.

@davidovitch
Copy link
Member

I think it would probably be better to just get rid of pyscaffold altogether and create a proper setup.py and config file. That's more transparent and is also the way most bigger projects do it.

@ricbencar
Copy link
Author

Also a conda or pip install would be much easier, despite a few atempts, I was never able to install pywafo.

@morbult
Copy link
Contributor

morbult commented Apr 13, 2020

Releasing wheels and conda packages would for sure be much appreciated by many people. I'd be happy to help to redo setup.py, make conda recipes etc if needed. I only run on Windows though and never got the Fortran extensions to compile correctly.

@davidovitch
Copy link
Member

Any help welcome! Getting the extensions to compile on Windows is not that straightforward, but it is doable. I am on Linux though and don't have working Windows setup ready to build the Windows packages.

A conda recipe would also be much appreciated.

@morbult
Copy link
Contributor

morbult commented Apr 13, 2020

@davidovitch Do you have any pointers on where to start looking to get it to work? It would be nice to be able to build properly.

The extensions actually do compile and I get 5 .pyd files (cov2mod.cp36-win_amd64.pyd etc) in the wafo root directory and 4 .dll files (libcov2mmpd.W3DEPWUJLPXUUDYGP7AWDSIKXZAYCO4Q.gfortran-win_amd64.dll etc) in wafo/.libs. However at import wafo.cov2mod I get ImportError: DLL load failed while importing cov2mod: The specified module could not be found. I have no idea where to go from here.

@davidovitch
Copy link
Member

@morbult note that @pbrod has started working already on a cleaner installation method, you can follow his progress in MR #48.

@Cubostar
Copy link

@morbult What version of SciPy did you use? I'm having trouble finding a valid version of SciPy for Python 3.7.

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

No branches or pull requests

9 participants