Using pipenv and briefcase, getting AttributeError for pip module - python

I'm attempting to briefcase a hello-world type script, from a virtual environment created using pipenv. My original python installation building using Anaconda, though I don't really need it as I don't use any of the scientific computing stack. I am not sure what I'm experiencing is a pipenv error, a pip error, or a briefcase error. If you could help me sort this, I would really appreciate it.
Briefcase
(root) C:\Users\stmwr\Dropbox\SoftwareProjects\helloworld-br\helloworld>python setup.py windows
running windows
Traceback (most recent call last):
File "setup.py", line 73, in <module>
'app_requires': [
File "C:\Users\stmwr\Anaconda3\lib\site-packages\setuptools\__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "C:\Users\stmwr\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\stmwr\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\stmwr\Anaconda3\lib\distutils\dist.py", line 973, in run_command
cmd_obj.ensure_finalized()
File "C:\Users\stmwr\Anaconda3\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Users\stmwr\Anaconda3\lib\site-packages\briefcase\windows.py", line 18, in finalize_options
finalized = self.get_finalized_command('app')
File "C:\Users\stmwr\Anaconda3\lib\distutils\cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "C:\Users\stmwr\Anaconda3\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Users\stmwr\Anaconda3\lib\site-packages\briefcase\app.py", line 123, in finalize_options
pip.utils.ensure_dir(self.download_dir)
AttributeError: module 'pip' has no attribute 'utils'

It's likely that this is an issue with Pipenv not supporting Pip 10 yet; in Pip 10, all internal APIs were moved around, which broke all applications that depended on them. I believe the aim is to have a release out soon.
If you can wait a couple of days and then update Pipenv, that will probably be easiest. If you can't wait, you could try to downgrade Pip to version 9.0.3, which should work again.

Related

Error in installing setuptools (unorderable types: str() < NoneType())

Python 3.4.2, 32 bit - Win 8.1, 64 bit
First I was trying to upgrade setuptools, but it was not successful. So I decided to uninstall the previous version. Now I can't install setuptools. I have tried the following:
pip install setuptools:
Exception:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\basecommand.py", line 232, in main
status = self.run(options, args)
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 339, in run
requirement_set.prepare_files(finder)
File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 229, in prepare_
files
req_to_install.check_if_exists()
File "C:\Python34\lib\site-packages\pip\req\req_install.py", line 928, in chec
k_if_exists
self.satisfied_by = pkg_resources.get_distribution(self.req)
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 461, in get_distribution
dist = get_provider(dist)
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 341, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 870, in require
needed = self.resolve(parse_requirements(requirements))
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 740, in resolve
env = Environment(self.entries)
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 927, in __init__
self.scan(search_path)
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 957, in scan
self.add(dist)
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 977, in add
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
TypeError: unorderable types: str() < NoneType()
Running (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | python - in a powershell with admin privileges:
PS C:\Windows\system32> > (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | python -
Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or
Internet Explorer's first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.
At line:1 char:4
+ > (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | python -
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
+ FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
(I'm not willing to install Internet Explorer right now, but if you think I have to, then I will.)
Downloaded the ez_setup.py and ran it:
Installing Setuptools
running install
Traceback (most recent call last):
File "setup.py", line 180, in <module>
dist = setuptools.setup(**setup_params)
File "C:\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\a\AppData\Local\Temp\tmpo7o_bqrd\setuptools-11.3.1\setuptools\c
ommand\install.py", line 67, in run
self.do_egg_install()
File "C:\Users\a\AppData\Local\Temp\tmpo7o_bqrd\setuptools-11.3.1\setuptools\c
ommand\install.py", line 103, in do_egg_install
cmd.ensure_finalized() # finalize before bdist_egg munges install cmd
File "C:\Python34\lib\distutils\cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "C:\Users\a\AppData\Local\Temp\tmpo7o_bqrd\setuptools-11.3.1\setuptools\c
ommand\easy_install.py", line 319, in finalize_options
self.index_url, search_path=self.shadow_path, hosts=hosts,
File "C:\Users\a\AppData\Local\Temp\tmpo7o_bqrd\setuptools-11.3.1\setuptools\p
ackage_index.py", line 269, in __init__
Environment.__init__(self,*args,**kw)
File "C:\Users\a\AppData\Local\Temp\tmpo7o_bqrd\setuptools-11.3.1\pkg_resource
s\__init__.py", line 975, in __init__
self.scan(search_path)
File "C:\Users\a\AppData\Local\Temp\tmpo7o_bqrd\setuptools-11.3.1\pkg_resource
s\__init__.py", line 1005, in scan
self.add(dist)
File "C:\Users\a\AppData\Local\Temp\tmpo7o_bqrd\setuptools-11.3.1\pkg_resource
s\__init__.py", line 1025, in add
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
TypeError: unorderable types: str() < NoneType()
Something went wrong during the installation.
See the error message above.
Repairing python installation by running python-3.4.2.msi and choosing the repair option. But still no setuptools:
>pip install scipy -U
Collecting scipy from https://pypi.python.org/packages/source/s/scipy/
.0.tar.gz#md5=639112f077f0aeb6d80718dc5019dc7a
Using cached scipy-0.15.0.tar.gz
setuptools must be installed to install from a source distribution
I think uninstalling and reinstalling python would fix the problem, but before trying that I thought maybe you can help me to find the cause of the problem and the right way to fix this. Thanks.
I was able to solve my problem (on Win 8.1 64bit, Python 3.4.2) with the change suggested here:
https://bitbucket.org/pypa/setuptools/pull-request/122/ensure-py_version-and-platform-are-str-in/diff#chg-pkg_resources/init.py
Instead of downloading ez_setup.py, use get-pip.py instead. From the docs, if setuptools is not installed, it will install it first.
Since you're still getting an error, try installing pip and setuptools from Christoph Gohlke's Python Extension Packages for Windows repository. Make sure you download the 32-bit installers for Python 3.4. Once downloaded, run the .exe files and hopefully everything will be back to normal. There are tons of scientific computing packages there, so if you want numpy linked against Intel's MKL, and scipy, which uses the enhanced version of numpy, go right ahead!
Well it seemed to me that my python installation was completely messed up. It could have been related to a temporary installation of python 2 on my system a few weeks ago. Anyway, I thought it would be easier for me to just uninstall and reinstall the whole thing. So I uninstalled python and then reinstalled, but even that was not enough. Finally, I manually deleted C:\Python34 and reinstalled python and now it works fine.

Pycharm issues with installing Setuptools

I have recently played around with different versions of Python 2.7 and I ended up breaking PyCharm.
Firstly I have uninstalled and reinstalled Python and Pycharm multiple times with no luck.
I get the feeling that setup tools is the main issue but I can't seem to get it uninstalled correctly...
Below is the error Pycharm is giving and I am seeing similar errors trying to fix setuptools manually.
Anybody have a clue what is wrong with my environment?
Install package failed.
The following command was executed:
c:\users\ask\appdata\local\temp\tmpf3zyjdpycharm-management\setuptools-1.1.5\setup.py install
The error output of the command:
Traceback (most recent call last):
File "c:\users\ask\appdata\local\temp\tmpf3zyjdpycharm-management\setuptools-1.1.5\setup.py", line 204, in <module>
dist = setuptools.setup(**setup_params)
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\users\ask\appdata\local\temp\tmpf3zyjdpycharm-management\setuptools-1.1.5\setuptools\command\install.py", line 73, in run
self.do_egg_install()
File "c:\users\ask\appdata\local\temp\tmpf3zyjdpycharm-management\setuptools-1.1.5\setuptools\command\install.py", line 82, in do_egg_install
easy_install = self.distribution.get_command_class('easy_install')
File "c:\users\ask\appdata\local\temp\tmpf3zyjdpycharm-management\setuptools-1.1.5\setuptools\dist.py", line 363, in get_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "c:\users\ask\appdata\local\temp\tmpf3zyjdpycharm-management\setuptools-1.1.5\pkg_resources.py", line 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "c:\users\ask\appdata\local\temp\tmpf3zyjdpycharm-management\setuptools-1.1.5\setuptools\command\easy_install.py", line 34, in <module>
from setuptools.sandbox import run_setup
File "c:\users\ask\appdata\local\temp\tmpf3zyjdpycharm-management\setuptools-1.1.5\setuptools\sandbox.py", line 209, in <module>
_EXCEPTIONS.append(GetGeneratePath())
File "win32com\client\gencache.pyc", line 131, in GetGeneratePath
AssertionError: Why do you want the genpath for a readonly store?
I finally managed to get this resolved. I installed a library called Automa about the same time I started getting the issue. With the install I had to add a PYTHONPATH entry and when I removed it today setup tools was able to install again.
I have added the PYTHONPATH back again and I am still able to install libraries with setupTools/Pip. So it must have not liked the path while installing.
I very happy to be back on track again!!!! :)

Python 3.3.4 Cx_Freeze ImportError: DDL load failed: The specified module could not be found

I am attempting to use cx_Freeze to turn a .py file that I wrote in Python 3.3.4. In running the build command, I get the following error.
C:\Python33>c:\python33\python.exe setup.py build
running build
running build_exe
Traceback (most recent call last):
File "setup.py", line 22, in <module>
executables=executables
File "c:\python33\lib\site-packages\cx_Freeze\dist.py", line 365, in setup
distutils.core.setup(**attrs)
File "c:\python33\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\python33\lib\distutils\dist.py", line 930, in run_commands
self.run_command(cmd)
File "c:\python33\lib\distutils\dist.py", line 949, in run_command
cmd_obj.run()
File "c:\python33\lib\distutils\command\build.py", line 126, in run
self.run_command(cmd_name)
File "c:\python33\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python33\lib\distutils\dist.py", line 949, in run_command
cmd_obj.run()
File "c:\python33\lib\site-packages\cx_Freeze\dist.py", line 234, in run
metadata = metadata)
File "c:\python33\lib\site-packages\cx_Freeze\freezer.py", line 101, in __init
__
for n in self._GetDefaultBinPathExcludes() + binPathExcludes]
File "c:\python33\lib\site-packages\cx_Freeze\freezer.py", line 235, in _GetDe
faultBinPathExcludes
import cx_Freeze.util
ImportError: DLL load failed: The specified module could not be found.
Have I not installed cx_freeze correctly? Or am I running it all wrong?
Help is greatly appreciated.
Thanks
Well, I found an answer that works for me.
Turns out there's a bug in cx_Freeze 4.3.4 and downgrading to 4.3.3 solved this problem for me.
Try opening up the util.pyd file with a tool like Dependency Walker in order to check if the error is a result of missing dependencies. I found that it was trying to load msvcr100.dll from the Microsoft Visual C++ 2010 runtime which I did not have installed on my machine. If this is also the source of your error, you can try running the x86 / x64 installer to see if this addresses it (you want to pick the one that matches the architecture of your Python installation not of your OS).

Howto install distribute for Python 3

I am trying to install distribute using ActivePython 3.1.2 on Windows.
Running python distribute_setup.py as described on the cheese shop give me:
No setuptools distribution found
running install
Traceback (most recent call last):
File "setup.py", line 177, in
scripts = scripts,
File "C:\Dev\Python_x86\3.1\lib\distutils\core.py", line 149, in setup
dist.run_commands()
File "C:\Dev\Python_x86\3.1\lib\distutils\dist.py", line 919, in run_commands
self.run_command(cmd)
File "C:\Dev\Python_x86\3.1\lib\distutils\dist.py", line 938, in run_command
cmd_obj.run()
File "build\src\setuptools\command\install.py", line 73, in run
self.do_egg_install()
File "build\src\setuptools\command\install.py", line 82, in do_egg_install
easy_install = self.distribution.get_command_class('easy_install')
File "build\src\setuptools\dist.py", line 361, in get_command_class
self.cmdclass[command] = cmdclass = ep.load()
File "build\src\pkg_resources.py", line 1953, in load
entry = import(self.module_name, globals(),globals(), ['name'])
File "build\src\setuptools\command\easy_install.py", line 16, in
from setuptools.sandbox import run_setup
File "build\src\setuptools\sandbox.py", line 164, in
fromlist=['name']).file)
AttributeError: 'module' object has no attribute 'file'
Something went wrong during the installation.
See the error message above.
Is there possibly an unknown dependency that I'm missing?
Downloading the source tarball and executing python setup.py install produces the exact same output.
Edit: Added the full stack trace for running the installer.
So apparently the python.org version of Python3 is different from the ActiveState version of Python3. (You should file a bug to someone (I'm not sure to whom))
The fix I have (I'm not sure of all the repercussions)
Download:
http://pypi.python.org/packages/source/d/distribute/distribute-0.6.12.tar.gz#md5=5a52e961f8d8799d243fe8220f9d760e
and then extracting it and modify:
distribute-0.6.12\setuptools\sandbox.py:165
from:
except ImportError:
to
except (ImportError, AttributeError):
that will silence the error and allow you to run:
python setup.py install
It took me awhile to find a package from http://pypi.python.org/pypi?:action=browse&c=533&show=all that would actually install on either version of Python3. "files" was the first package, and since it installed I am pretty sure that easy_install is working for both copies of Python3.
...hope it works! (That's all I can help you with)
this is a bug with Distribute http://bitbucket.org/tarek/distribute/issue/151 ... it should be fixed by next release (0.6.13). It is only reproducible with PyWin32 installed; and ActivePython comes bundled with PyWin32.

Problem using easy_install on Windows 7, 64 bit. (cannot find python.exe)

I have just now installed Python 2.6 on my Windows 7 (64 bit) Lenovo t61p laptop.
I have downloaded Sphinx and nose and apparently installed them correctly using
python setup.py install
(at least no errors were reported during the installation).
Now I am trying to install pymongo using easy_install but I am not having much success. It seems that easy_install isn't working at all. I execute easy_install as administrator:
C:\>easy_install
Cannot find Python executable C:\Program Files\Python26\python.exe
The path C:\Program Files\Python26\python.exe is correct.
I have found this bug report on bugs.python.org which seems to be related, although its status is 'Resolved'.
Do you have any ideas as to what may be wrong? Any pointers, hints or tips for diagnosing the problem further would be greatly appreciated.
EDIT: This is the stacktrace I receive when trying to install pymongo:
C:\Users\Rune Ibsen\Documents\Downloads\pymongo-1.4>python setup.py install
running install
running bdist_egg
running egg_info
writing pymongo.egg-info\PKG-INFO
writing top-level names to pymongo.egg-info\top_level.txt
writing dependency_links to pymongo.egg-info\dependency_links.txt
reading manifest file 'pymongo.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pymongo.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building 'pymongo._cbson' extension
Traceback (most recent call last):
File "setup.py", line 166, in <module>
"doc": doc})
File "C:\Program Files\Python26\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Program Files\Python26\lib\distutils\dist.py", line 975, in run_commands
self.run_command(cmd)
File "C:\Program Files\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "C:\Program Files\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\command\install.py", line 76, in run
File "C:\Program Files\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\command\install.py", line 96, in do_egg_install
File "C:\Program Files\Python26\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "C:\Program Files\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\command\bdist_egg.py", line 174, in run
File "C:\Program Files\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\command\bdist_egg.py", line 161, in call_command
File "C:\Program Files\Python26\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "C:\Program Files\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\command\install_lib.py", line 20, in run
File "C:\Program Files\Python26\lib\distutils\command\install_lib.py", line 113, in build
self.run_command('build_ext')
File "C:\Program Files\Python26\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "setup.py", line 107, in run
build_ext.run(self)
File "C:\Program Files\Python26\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "C:\Program Files\Python26\lib\distutils\command\build_ext.py", line 449, in build_extensions
self.build_extension(ext)
File "setup.py", line 117, in build_extension
build_ext.build_extension(self, ext)
File "C:\Program Files\Python26\lib\distutils\command\build_ext.py", line 499, in build_extension
depends=ext.depends)
File "C:\Program Files\Python26\lib\distutils\msvc9compiler.py", line 448, in compile
self.initialize()
File "C:\Program Files\Python26\lib\distutils\msvc9compiler.py", line 358, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Program Files\Python26\lib\distutils\msvc9compiler.py", line 274, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: [u'path']
C:\Users\Rune Ibsen\Documents\Downloads\pymongo-1.4>
PS.: I previously installed Python 3.1 but later installed 2.6 because I am not sure whether pymongo supports 3.1.
PPS.: I have tried installing pymongo using the python setup.py install approach, but this resulted in a nasty-looking stack trace, so I thought I would try to let easy_install take care of it for me.
PPPS.: I am completely new to Python, easy_install, eggs etc.
I don't know anything about these specific packages so I may not be much help. But for what it's worth I have run into the "can't find python executable" errors before with 64 bit python. It happened when the package I was trying to install didn't have a 64 bit version and it was looking for 32 bit python. I ended up just installing and using the 32 bit python. That may not be the issue here, but I figured I'd through it out there.
can't help much with easy_install - but python setup.py install should work w/ pymongo. what was the stack trace?
Install this 64-bit version of setuptools instead.
http://www.lfd.uci.edu/~gohlke/pythonlibs/#setuptools

Categories