Skip to content

Problem with setup.py in 0.1.4 stable release: NameError: name 'version' is not defined at line 32 #60

@davidjstudholme

Description

@davidjstudholme

I am using the tarball for the stable release v0.1.4 from here: https://github.com/widdowquinn/find_differential_primers/archive/refs/tags/v0.1.4.tar.gz.

After doing conda install --file requirements-thirdparty.txt and conda install --file requirements.txt, I attempt to run the setup.py script:

python3 setup.py install --prefix ~

This yields the following error message:

Traceback (most recent call last):
  File "/data/djs217/stable_release/find_differential_primers-0.1.4/setup.py", line 32, in <module>
    version = version,
NameError: name 'version' is not defined

Maybe the script needs to be executed with python2 rather than python3? So, I checked this:

python --version
Python 2.7.18 :: Anaconda, Inc.

Executing the script using this python gives a similar error message:

python setup.py install --prefix ~

Traceback (most recent call last):
  File "setup.py", line 32, in <module>
    version = version,
NameError: name 'version' is not defined

Does this suggest a bug at line 32 in setup.py? Or an I doing something daft?

Just to be absolutely clear, this is first few lines of the code that I see in setup.py:

# try using distribute or setuptools or distutils.
try:
    import distribute_setup
    distribute_setup.use_setuptools()
except:
    pass

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup


import sys
import re

# parse version from package/module without importing or evaluating the code
with open('find_differential_primers/find_differential_primers.py') as fh:
    for line in fh:
        m = re.search(r"^__version__ = '(?P<version>[^']+)'$", line)
        if m:
            version = m.group('version')
            break

if sys.version_info <= (2, 6):
    sys.stderr.write("ERROR: pyADHoRe requires Python Version 2.7 or " +
                     "above...exiting.\n")
    sys.exit(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions