FragIt / fragit-main

FragIt main repository
Other
25 stars 12 forks source link

python setup.py install throws deprecated warwning #38

Closed acnash closed 8 months ago

acnash commented 9 months ago

To install fragit I've performed the following steps:

conda create -n frag_it python=3.8
conda activate frag_it
git clone https://github.com/FragIt/fragit-main.git
cd fragit-main

And then as per the README I tried:

python setup.py install

which results in numerous warning.


(frag_it) anthony@mechanicus:~/fragit-main$ python setup.py install
Warning: 'classifiers' should be a list, got type 'filter'
/home/anthony/anaconda3/envs/psi4_python_3_11/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
/home/anthony/anaconda3/envs/psi4_python_3_11/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  self.initialize_options()
zip_safe flag not set; analyzing archive contents...

Then I tried executing fragit from the command line and I get the warning:

(frag_it) anthony@mechanicus:~/fragit-main$ fragit
/home/anthony/anaconda3/envs/frag_it/bin/fragit:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  __import__('pkg_resources').run_script('fragit==1.9.0', 'fragit')
Traceback (most recent call last):
  File "/home/anthony/anaconda3/envs/frag_it/bin/fragit", line 4, in <module>
    __import__('pkg_resources').run_script('fragit==1.9.0', 'fragit')
  File "/home/anthony/anaconda3/envs/frag_it/lib/python3.8/site-packages/pkg_resources/__init__.py", line 722, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/anthony/anaconda3/envs/frag_it/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1548, in run_script
    raise ResolutionError(
pkg_resources.ResolutionError: Script 'scripts/fragit' not found in metadata at '/home/anthony/fragit-main/fragit.egg-info'

Please note, by following the default installation and not setting a customer prefix, I have not made any adjustment to my PATH or PYTOHNPATH - I'm assuming it's unnecessary as python setup.py install should send everything to the default path.

This might be a simple change to the README to bring it up to date. These deprecation warnings don't explicitly state how to use pypa/build or pypa/installer to help the user. Can these warnings be ignored? Also, I am very sorry if I missed this elsewhere, but what version of Python does fragit require? I noticed 2.7 was mentioned, but not stated whether it was a strict requirement. And finally, any thoughts on why fragit throws a DeprecationWarning?

Thank you for your software and your hard work. It's appreciated.

cstein commented 9 months ago

Dear @acnash,

thanks for bringing this to my attention. I recently discovered that the distribution of python packages has changed over the last 6 years (who knew?!). I will seek to fix this issue as soon as I have time to - it is more about understanding what needs to be done than actually implementing it. As far as I know, the warnings can be ignored but I suspect it will not work with python 3.12.

In regards to what Python version FragIt requires - I believe that the README file is hopelessly outdated. The currently supported (and tested versions) are python 3.9, 3.10 and 3.11. I will also update the README file.

Thanks for this report - much appreciated :)

cstein commented 9 months ago

Ok, so a slight update here @acnash. I will push a new release with an updated README.md file with updated installation instructions. Luckily, you are using conda also so it will be very easy:

git clone https://github.com/FragIt/fragit-main.git
conda env create -n fragit python=3.9
conda activate fragit
conda install numpy openbabel
cd fragit-main
pip install .

and that should be it. I will provide an environment.yml file in the next update (1.9.1). I will open a new issue to tackle the deprecation warnings in a separate issue when this issue is closed.

Thanks for your feedback!

acnash commented 9 months ago

Hi @cstein thank you for looking into this. Sorry I didn't reply to your earlier response, I've got a million tasks on the go. I managed to get it working, and the steps were very similar. I must retry on a clean machine because what you've listed above because I added sudo apt install openbabel python3-openbabel.

When I tried only using conda install openbabel, I couldn't get fragit to run and I suspect it was the python C binders. I'm not an expert in linux package management by any stretch of the imagination, but please do check (I'm not sure how), whether you also have python3-openbabel installed via apt install because I suspect it might be a dependency and I don't think apt install modules show in conda list.

Thanks for you quick response to my problem. It's very appreciated.

cstein commented 9 months ago

Hi @acnash,

Yeah - i see your point. I will try with a clean VM when I get the chance! However, the continouous integration that I set up with github actions is technically starting from a clean slate everytime and that passes just fine:

https://github.com/FragIt/fragit-main/actions/workflows/fragit_with_conda.yml

It is using the same installation instructions that will be present in the forthcming 1.9.1 release based on this issue 👍

cstein commented 9 months ago

Alright, small update - just installed ubuntu server 22.04.3 from scratch in a VM. The installation instructions works just fine once conda is installed - never had to touch the built-in package manager on ubuntu.