Pycharm issues with installing Setuptools - python

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!!!! :)

Related

py2app - IndexError: tuple index out of range

Getting the following error when trying to build my application. My code runs smoothly inside VScode (running the python file directly). I've looked online and I can't seem to find anyone who's had this error pop up. It used to happen to me when I wasn't in my virtual environment, but I definitely am now (source venv/bin/activate). What could it be? Thanks
Traceback (most recent call last):
File "/Users/wiggly/Desktop/twitterBot/setup.py", line 14, in <module>
setup(
^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/distutils/core.py", line 148, in setup
dist.run_commands()
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/distutils/dist.py", line 985, in run_command
cmd_obj.run()
^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/build_app.py", line 967, in run
self._run()
^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/build_app.py", line 1197, in _run
self.run_normal()
^^^^^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/build_app.py", line 1294, in run_normal
self.process_recipes(mf, filters, flatpackages, loader_files)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/build_app.py", line 1143, in process_recipes
rval = check(self, mf)
^^^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/recipes/detect_dunder_file.py", line 54, in check
scan_bytecode_loads(names, node.code)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/recipes/detect_dunder_file.py", line 31, in scan_bytecode_loads
scan_bytecode_loads(names, c)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/wiggly/Desktop/twitterBot/venv/lib/python3.11/site-packages/py2app/recipes/detect_dunder_file.py", line 25, in scan_bytecode_loads
name = co.co_names[inst.arg]
~~~~~~~~~~~^^^^^^^^^^
IndexError: tuple index out of range
I use the default setup.py using the command provided in the docs py2applet --make-setup bot.py
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ["bot.py"]
DATA_FILES = []
OPTIONS = {}
setup(
app=APP,
data_files=DATA_FILES,
options={"py2app": OPTIONS},
setup_requires=["py2app"],
)
The problem is that you have installed a beta version of Python (version 3.11). And looks like py2app version 0.28.2 is not compatible with it. Try to uninstall the 3.11 version and install the current release version 3.10 and it should work. Also, recreate the virtual environment after you install it because the current one would still be pointing to the 3.11 version.

Installing pyreadline on portable python

I recently got portable python 2.7.6.1 from here
I need to install pyreadline to this
I downloaded pyreadline zip file from https://pypi.org/project/pyreadline/#files
Is this zip file enough to get pyreadline installed in potable python? I don't have prior experience with python but I have read other posts about people trying to install modules to portable python so I am guessing it should be possible
I tried installing pip using easy_setup pip on the command prompt but I get the following error:
Searching for pip
Reading http://pypi.python.org/simple/pip/
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for pip
Best match: None
Traceback (most recent call last):
File "D:\data_aba\python files\python_portable_2761\App\Scripts\easy_install-script.py", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "D:\data_aba\python files\python_portable_2761\App\lib\site-packages\setuptools\command\easy_install.py", line 1712, in main
with_ei_usage(lambda:
File "D:\data_aba\python files\python_portable_2761\App\lib\site-packages\setuptools\command\easy_install.py", line 1700, in with_ei_usage
return f()
File "D:\data_aba\python files\python_portable_2761\App\lib\site-packages\setuptools\command\easy_install.py", line 1716, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "D:\data_aba\python files\python_portable_2761\App\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "D:\data_aba\python files\python_portable_2761\App\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "D:\data_aba\python files\python_portable_2761\App\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "D:\data_aba\python files\python_portable_2761\App\lib\site-packages\setuptools\command\easy_install.py", line 211, in run
self.easy_install(spec, not self.no_deps)
File "D:\data_aba\python files\python_portable_2761\App\lib\site-packages\setuptools\command\easy_install.py", line 434, in easy_install
self.local_index
File "D:\data_aba\python files\python_portable_2761\App\lib\site-packages\setuptools\package_index.py", line 475, in fetch_distribution
return dist.clone(location=self.download(dist.location, tmpdir))
AttributeError: 'NoneType' object has no attribute 'clone'
Is there any way to install pyreadline from the contents of the zip file, or at least get pip installed so that I can use it to search for pyreadline?
EDIT 1 ---
I went to https://pypi.org/simple/pip/ and downloaded pip-18.0.tar.gz. Is there any way I can install this manually from this zip file? But then again if that was possible, I assume it should be possible to just install pyreadline directly? How can I do this manunaly?

Using pipenv and briefcase, getting AttributeError for pip module

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.

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).

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