materialsproject/reaction-network

Setup Issue (setuptools-scm was unable to detect version for)

Closed this issue · 5 comments

103-5 commented

I follow the instruction in the README and all steps are completed except
pip install -e . , it results in lots of errors (see below).
It seems that setup.py needs to be modified due to

LookupError: setuptools-scm was unable to detect version for /root.

I've tried the solution (as following) in pypa/setuptools-scm#536 but it doesn't work
use_scm_version={"root": "..", "relative_to": __file__, "version_scheme": "no-guess-dev"},

Here is the errors:

(gt) root@iZ8vb98m8jfeytc3k1bao2Z:~/reaction-network-main# pip install -e.
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Obtaining file:///root/reaction-network-main
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
?python setup.py egg_info did not run successfully.
\u2502 exit code: 1
\u2570\u2500> [32 lines of output]
/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools/dist.py:744: UserWarning: Usage of dash-separated 'index-url' will not be supported in future versions. Please use the underscore name 'index_url' instead
warnings.warn(
/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'extra_requires'
warnings.warn(msg)
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/root/reaction-network-main/setup.py", line 12, in
setup(
File "/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools/init.py", line 79, in setup
return distutils.core.setup(**attrs)
File "/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 109, in setup
_setup_distribution = dist = klass(attrs)
File "/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools/dist.py", line 462, in init
_Distribution.init(
File "/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 293, in init
self.finalize_options()
File "/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools/dist.py", line 868, in finalize_options
ep(self)
File "/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools/dist.py", line 889, in _finalize_setup_keywords
ep.load()(self, ep.name, value)
File "/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools_scm/integration.py", line 75, in version_keyword
_assign_version(dist, config)
File "/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools_scm/integration.py", line 51, in _assign_version
_version_missing(config)
File "/root/anaconda3/envs/gt/lib/python3.8/site-packages/setuptools_scm/init.py", line 106, in _version_missing
raise LookupError(
LookupError: setuptools-scm was unable to detect version for /root.
Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.
For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
[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.
\u2570\u2500> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Hi @103-5 , thanks for raising an issue! I am not an expert with setup-tools, but it might be a problem with how you've downloaded the code. Are you downloading via a ZIP file or using Git to clone the repo to your machine?

103-5 commented

Hi @mattmcdermott, thanks for your attention. I downloaded the ZIP file and unzipped it to the root folder.
image

The good news is I was able to recreate your error by downloading the ZIP folder; I hadn't noticed this problem because I always install via git clone https://github.com/GENESIS-EFRC/reaction-network.git.

Since this seems more like a pip metadata issue, I would suggest one of these two options:

  1. install a non-editable version of the code by doing pip install reaction-network (this will download and install from PyPI)
  2. Install an editable version of the code by using the git clone command above and then the usual pip install -e . from within the directory.

If you are not doing any development on the code, then Option 1 should be very straightforward -- just make sure if you're running stuff with networks to install the additional graph-tool dependency as is specified in the README instructions.

103-5 commented

The good news is I was able to recreate your error by downloading the ZIP folder; I hadn't noticed this problem because I always install via git clone https://github.com/GENESIS-EFRC/reaction-network.git.

Since this seems more like a pip metadata issue, I would suggest one of these two options:

  1. install a non-editable version of the code by doing pip install reaction-network (this will download and install from PyPI)
  2. Install an editable version of the code by using the git clone command above and then the usual pip install -e . from within the directory.

If you are not doing any development on the code, then Option 1 should be very straightforward -- just make sure if you're running stuff with networks to install the additional graph-tool dependency as is specified in the README instructions.

Thanks for your help. Both of these two options works! The downloaded zip lacks .git folder compared to git clone one, and it might be the reason why the pip metadata issue exists.

That's great to hear you got it working! I'll make a note in the README instructions in a future PR.