1. Bruce Kroeze
  2. django-livesettings
  3. Issues
Issue #38 resolved

NameError: global name 'pkg_resources' is not defined

Praveen Kumar
created an issue

Running sudo python setup.py install

Output :

Traceback (most recent call last): File "setup.py", line 32, in <module> include_package_data = True, File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup _setup_distribution = dist = klass(attrs) File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 260, in init self.fetch_build_eggs(attrs.pop('setup_requires')) File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 284, in fetch_build_eggs parse_requirements(requires), installer=self.fetch_build_egg File "/Library/Python/2.7/site-packages/pkg_resources.py", line 563, in resolve dist = best[req.key] = env.best_match(req, self, installer) File "/Library/Python/2.7/site-packages/pkg_resources.py", line 799, in best_match return self.obtain(req, installer) # try and download/install File "/Library/Python/2.7/site-packages/pkg_resources.py", line 811, in obtain return installer(requirement) File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 325, in fetch_build_egg cmd.ensure_finalized() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized self.finalize_options() File "/Library/Python/2.7/site-packages/setuptools/command/easy_install.py", line 171, in finalize_options self.index_url, search_path = self.shadow_path, hosts=hosts, File "/Library/Python/2.7/site-packages/setuptools/package_index.py", line 161, in init if verify_ssl and ssl_support.is_available and (ca_bundle or ssl_support.find_ca_bundle()): File "/Library/Python/2.7/site-packages/setuptools/ssl_support.py", line 239, in find_ca_bundle return pkg_resources.resource_filename('certifi', 'cacert.pem') NameError: global name 'pkg_resources' is not defined

Comments (3)

  1. Hynek Cernoch

    First I paste your traceback correctly formated. (Use the button "Code" after pasting anything with fixed line ends and after selecting that block.)

    Traceback (most recent call last):
      File "setup.py", line 32, in &lt;module&gt;
        include_package_data = True,
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 260, in <strong>init</strong>
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 284, in fetch_build_eggs
        parse_requirements(requires), installer=self.fetch_build_egg
      File "/Library/Python/2.7/site-packages/pkg_resources.py", line 563, in resolve
        dist = best[req.key] = env.best_match(req, self, installer)
      File "/Library/Python/2.7/site-packages/pkg_resources.py", line 799, in best_match
        return self.obtain(req, installer) # try and download/install
      File "/Library/Python/2.7/site-packages/pkg_resources.py", line 811, in obtain
        return installer(requirement)
      File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 325, in fetch_build_egg
        cmd.ensure_finalized()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/Library/Python/2.7/site-packages/setuptools/command/easy_install.py", line 171, in finalize_options
        self.index_url, search_path = self.shadow_path, hosts=hosts,
      File "/Library/Python/2.7/site-packages/setuptools/package_index.py", line 161, in <strong>init</strong>
        if verify_ssl and ssl_support.is_available and (ca_bundle or ssl_support.find_ca_bundle()):
      File "/Library/Python/2.7/site-packages/setuptools/ssl_support.py", line 239, in find_ca_bundle
        return pkg_resources.resource_filename('certifi', 'cacert.pem')
    NameError: global name 'pkg_resources' is not defined
    

    I see the directories:

    /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils
    /Library/Python/2.7/site-packages/setuptools/
    

    I think that your problem is related to PYTHONPATH and multiple Python directories.

    Distribute usually replaces some files from setuptools by fixed versions. I am afraid that an unfixed version is on your python path earlier than the fixed.

    I am afraid that you can not install by sudo python setup.py install many other packages with your current configuration. Therefore the problem can not be related to livesettings. I recommend to use the easy solution virtualenv with options --distribute --no-site-packages.

    I do not see any "setuptools/ssl_support.py" in on the internet or in any my computer and I do not know what is the file, from which package.

    If you can describe and reproduce the problem on other machine where only one Python is installed on the path then anything can be fixed.

  2. Praveen Kumar reporter

    Hynek Cernoch I am sorry to write my question in casual way. Yes there were three python version installed on my system so there was an ambiguity which i realized later. I fixed it by uninstall the python and re-install it. Problem was not with django-livesettings. Thanks for your quick response.

  3. Log in to comment