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

LookupError: setuptools-scm was unable to detect version (when using python setup.py install) #536

Closed
yuqi9993 opened this issue Mar 17, 2021 · 5 comments

Comments

@yuqi9993
Copy link

Hi there, I’m trying to install setup.py (from the website: https://github.com/richpsharp/ipbes-analysis/tree/1.1.0/ipbes-ndr) in the python virtual environment 3.7 (named “py37”).

I typed in:

  1. git clone https://github.com/richpsharp/ipbes-analysis.git
  2. cd ipbes-analysis\ipbes-ndr
  3. python setup.py install

However, I got the error:

C:\Users\86134>activate py37
(py37) C:\Users\86134>cd ipbes-analysis\ipbes-ndr
(py37) C:\Users\86134\ipbes-analysis\ipbes-ndr>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    language="c++",
  File "F:\Anaconda3\envs\py37\lib\site-packages\setuptools\__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "F:\Anaconda3\envs\py37\lib\distutils\core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "F:\Anaconda3\envs\py37\lib\site-packages\setuptools\dist.py", line 433, in __init__
    k: v for k, v in attrs.items()
  File "F:\Anaconda3\envs\py37\lib\distutils\dist.py", line 292, in __init__
    self.finalize_options()
  File "F:\Anaconda3\envs\py37\lib\site-packages\setuptools\dist.py", line 708, in finalize_options
    ep(self)
  File "F:\Anaconda3\envs\py37\lib\site-packages\setuptools\dist.py", line 715, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
  File "F:\Anaconda3\envs\py37\lib\site-packages\setuptools_scm\integration.py", line 26, in version_keyword
    dist.metadata.version = _get_version(config)
  File "F:\Anaconda3\envs\py37\lib\site-packages\setuptools_scm\__init__.py", line 173, in _get_version
    parsed_version = _do_parse(config)
  File "F:\Anaconda3\envs\py37\lib\site-packages\setuptools_scm\__init__.py", line 142, in _do_parse
    "use git+https://github.com/user/proj.git#egg=proj" % config.absolute_root
LookupError: setuptools-scm was unable to detect version for 'C:\\Users\\86134\\ipbes-analysis\\ipbes-ndr'.

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

The contents of setup.py are:

"""setup.py module for ipbes_ndr_analysis module."""
from Cython.Build import cythonize
import numpy
from setuptools.extension import Extension
from setuptools import setup

setup(
    name='ipbes ndr analysis',
    packages=[
        'ipbes_ndr_analysis',
    ],
    package_dir={
        'ipbes_ndr_analysis': 'src/ipbes_ndr_analysis'
    },

    use_scm_version={
        'version_scheme': 'post-release',
        'local_scheme': 'node-and-date'},
    setup_requires=['setuptools_scm', 'cython', 'numpy'],
    include_package_data=True,
    ext_modules=cythonize(
        [Extension(
            "ipbes_ndr_analysis_cython",
            sources=["src/ipbes_ndr_analysis/ipbes_ndr_analysis_cython.pyx"],
            include_dirs=[numpy.get_include()],
            language="c++",
        )],
        )
)

I'm not sure how to fix this error...Any help would be appreciated. Thanks!!
Yuqi

@RonnyPfannschmidt
Copy link
Contributor

the fix is

iff --git a/ipbes-ndr/setup.py b/ipbes-ndr/setup.py
index c506bf7..2bc8d36 100644
--- a/ipbes-ndr/setup.py
+++ b/ipbes-ndr/setup.py
@@ -15,7 +15,10 @@ setup(
 
     use_scm_version={
         'version_scheme': 'post-release',
-        'local_scheme': 'node-and-date'},
+        'local_scheme': 'node-and-date',
+        "relative_to": __file__,
+        "root": "..",
+    },
     setup_requires=['setuptools_scm', 'cython', 'numpy'],
     include_package_data=True,
     ext_modules=cythonize(

@RonnyPfannschmidt
Copy link
Contributor

a better error would be helpful tho

@yuqi9993
Copy link
Author

the fix is

iff --git a/ipbes-ndr/setup.py b/ipbes-ndr/setup.py
index c506bf7..2bc8d36 100644
--- a/ipbes-ndr/setup.py
+++ b/ipbes-ndr/setup.py
@@ -15,7 +15,10 @@ setup(
 
     use_scm_version={
         'version_scheme': 'post-release',
-        'local_scheme': 'node-and-date'},
+        'local_scheme': 'node-and-date',
+        "relative_to": __file__,
+        "root": "..",
+    },
     setup_requires=['setuptools_scm', 'cython', 'numpy'],
     include_package_data=True,
     ext_modules=cythonize(

Thanks!!
I modified the setup.py codes as:

"""setup.py module for ipbes_ndr_analysis module."""
from Cython.Build import cythonize
import numpy
from setuptools.extension import Extension
from setuptools import setup

setup(
    name='ipbes ndr analysis',
    packages=[
        'ipbes_ndr_analysis',
    ],
    package_dir={
        'ipbes_ndr_analysis': 'src/ipbes_ndr_analysis'
    },

    use_scm_version={
        'version_scheme': 'post-release',
        'local_scheme': 'node-and-date',
        "relative_to": __file__,
        "root": "..",
        },
    setup_requires=['setuptools_scm', 'cython', 'numpy'],
    include_package_data=True,
    ext_modules=cythonize(
        [Extension(
            "ipbes_ndr_analysis_cython",
            sources=["src/ipbes_ndr_analysis/ipbes_ndr_analysis_cython.pyx"],
            include_dirs=[numpy.get_include()],
            language="c++",
        )],
        )
)

However, I got another error:

(py37) C:\Users\86134\ipbes-analysis\ipbes-ndr>python setup.py install
running install
running bdist_egg
running egg_info
writing ipbes_ndr_analysis.egg-info\PKG-INFO
writing dependency_links to ipbes_ndr_analysis.egg-info\dependency_links.txt
writing top-level names to ipbes_ndr_analysis.egg-info\top_level.txt
writing manifest file 'ipbes_ndr_analysis.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building 'ipbes_ndr_analysis_cython' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

Perhaps, I just need to update the needed "Microsoft C++ Build Tools"? I will update it now. Thanks again!

@RonnyPfannschmidt
Copy link
Contributor

the new error is build tool related, i'm closing this as the setuptools_scm part seems to be resolved.

Happy Programming!

@yuqi9993
Copy link
Author

the new error is build tool related, i'm closing this as the setuptools_scm part seems to be resolved.

Happy Programming!
M

the new error is build tool related, i'm closing this as the setuptools_scm part seems to be resolved.

Happy Programming!

Many thanks!!!

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

2 participants