setuptools ez_setup return me UnicodeDecodeError - python-2.7

I'm using python 3.3 and Windows XP(32x).
I tried to install setuptools.
I write in command line:
py ez_setup.py install
And it return me error:
Traceback (most recent call last):
File "setup.py", line 19, in <module>
exec(init_file.read(), command_ns)
File "<string>", line 8, in <module>
File "c:\docume~1\jakov\locals~1\temp\tmpymerwg\setuptools-3.5.1\setuptools\_
init__.py", line 12, in <module>
from setuptools.extension import Extension
File "c:\docume~1\jakov\locals~1\temp\tmpymerwg\setuptools-3.5.1\setuptools\e
tension.py", line 7, in <module>
from setuptools.dist import _get_unpatched
File "c:\docume~1\jakov\locals~1\temp\tmpymerwg\setuptools-3.5.1\setuptools\d
st.py", line 16, in <module>
from setuptools.compat import numeric_types, basestring
File "c:\docume~1\jakov\locals~1\temp\tmpymerwg\setuptools-3.5.1\setuptools\c
mpat.py", line 19, in <module>
from SimpleHTTPServer import SimpleHTTPRequestHandler
File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in <module>
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
File "C:\Python27\lib\SimpleHTTPServer.py", line 208, in SimpleHTTPRequestHan
ler
mimetypes.init() # try to read system mime.types
File "C:\Python27\lib\mimetypes.py", line 358, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 258, in read_windows_registry
for subkeyname in enum_types(hkcr):
File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9e in position 6: ordinal
not in range(128)
Something went wrong during the installation.
See the error message above.
I am also using python 2.7, but I want to install setuptools for python 3.3.

I open my file with IDE and run it(because if you run code from cmd and you have both python2 and python3 it will run with python2 and iif you run it from IDE for python3 it will run in python3).
I really don't know if my explanation is true(because I don't have python2 on path), but I know that some files only work when you run it with IDE, and some only with cmd(or graphical).

Related

Using Python2 and scrapy ImportError: cannot import name suppress

Hi am trying to run a scraper on ubuntu/windows machine .
I have installed scrapy version- Scrapy 1.8.0 on using python2.
I am able create a project, but when I run a scraper this error in shown.
Traceback (most recent call last):
File "/home/ubuntu/.local/bin/scrapy", line 8, in <module>
sys.exit(execute())
File "/home/ubuntu/.local/lib/python2.7/site-packages/scrapy/cmdline.py", line 146, in execute
_run_print_help(parser, _run_command, cmd, args, opts)
File "/home/ubuntu/.local/lib/python2.7/site-packages/scrapy/cmdline.py", line 100, in _run_print_help
func(*a, **kw)
File "/home/ubuntu/.local/lib/python2.7/site-packages/scrapy/cmdline.py", line 154, in _run_command
cmd.run(args, opts)
File "/home/ubuntu/.local/lib/python2.7/site-packages/scrapy/commands/shell.py", line 68, in run
crawler.engine = crawler._create_engine()
File "/home/ubuntu/.local/lib/python2.7/site-packages/scrapy/crawler.py", line 111, in _create_engine
return ExecutionEngine(self, lambda _: self.stop())
File "/home/ubuntu/.local/lib/python2.7/site-packages/scrapy/core/engine.py", line 67, in __init__
self.scheduler_cls = load_object(self.settings['SCHEDULER'])
File "/home/ubuntu/.local/lib/python2.7/site-packages/scrapy/utils/misc.py", line 46, in load_object
mod = import_module(module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/ubuntu/.local/lib/python2.7/site-packages/scrapy/core/scheduler.py", line 7, in <module>
from queuelib import PriorityQueue
File "/home/ubuntu/.local/lib/python2.7/site-packages/queuelib/__init__.py", line 1, in <module>
from queuelib.queue import FifoDiskQueue, LifoDiskQueue
File "/home/ubuntu/.local/lib/python2.7/site-packages/queuelib/queue.py", line 7, in <module>
from contextlib import suppress
ImportError: cannot import name suppress
can anyone help to solve this issue?
The contextlib.suppress function supports from Python 3.4 but you are using Python 2.7. To solve this problem, upgrade your python version.
If this is useful for someone else, the solution for me (also using python 2.7) was:
pip uninstall attrs
pip uninstall queuelib
pip install queuelib==1.5.0
pip install attrs

Not able to resolve AttributeError: 'module' object has no attribute 'SSL_ST_INIT' while installing django dependencies

Using MacOS Sierra 10.12.6
Installing Django project dependencies from requirement.txt file
sudo pip install --user -r requirement.txt
I have looked over internet for the similar issues but none of them helped.
I even have tried uninstalling pyOpenSSL using command:
pip uninstall pyOpenSSL
even this command is giving an error:
Traceback (most recent call last):
File "/Users/RitZz/Desktop/work/bin/pip", line 11, in <module>
load_entry_point('pip==19.1', 'console_scripts', 'pip')()
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
return ep.load()
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2434, in load
return self.resolve()
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
from pip._internal.commands import (
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
from pip._internal.commands.completion import CompletionCommand
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
from pip._internal.cli.base_command import Command
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 20, in <module>
from pip._internal.download import PipSession
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/download.py", line 15, in <module>
from pip._vendor import requests, six, urllib3
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py", line 97, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/OpenSSL/SSL.py", line 124, in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
At few place it is mentioned to use:
sudo easy_install -U pyopenssl/pyOpenSSL
still getting same error.
even after deleting manually
> pyopenssl from python/2.7/site-packages/
and then reinstalling using command:
sudo pip install pyopenssl
it is not working, giving same error, (have also tried commands using --user flag)

Error while running odoo in mac

I am trying to install odoo in mac OS. I have installed all necessary requirements by referring a video on youtube and finally I tried to run server but I am getting an error like this:
lalits-MacBook-Pro:odoo lalitpatidar$ ./odoo-bin
Traceback (most recent call last):
File "./odoo-bin", line 5, in
__import__('pkg_resources').declare_namespace('odoo.addons')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1926, in declare_namespace
declare_namespace(parent)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1942, in declare_namespace
_handle_ns(packageName, path_item)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1912, in _handle_ns
loader.load_module(packageName); module.__path__ = path
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/Users/lalitpatidar/Desktop/v10/odoo/odoo/__init__.py", line 60, in
import modules
File "/Users/lalitpatidar/Desktop/v10/odoo/odoo/modules/__init__.py", line 8, in
from . import db, graph, loading, migration, module, registry
File "/Users/lalitpatidar/Desktop/v10/odoo/odoo/modules/graph.py", line 13, in
import odoo.osv as osv
File "/Users/lalitpatidar/Desktop/v10/odoo/odoo/osv/__init__.py", line 4, in
import osv
File "/Users/lalitpatidar/Desktop/v10/odoo/odoo/osv/osv.py", line 4, in
from ..exceptions import except_orm
File "/Users/lalitpatidar/Desktop/v10/odoo/odoo/exceptions.py", line 15, in
from tools.func import frame_codeinfo
File "/Users/lalitpatidar/Desktop/v10/odoo/odoo/tools/__init__.py", line 8, in
from misc import *
File "/Users/lalitpatidar/Desktop/v10/odoo/odoo/tools/misc.py", line 16, in
import passlib.utils
ImportError: No module named passlib.utils
I am new in odoo and stackoverflow as well so please avoid my little mistake if any.
You can install passlib module using pip
sudo pip install passlib

python virtualenv is not creating

i want to create python virtualenv with python version 2.7.6 but there is error as follow , even i wanted to reinstall pip but it showed that pip is of latest version:
$ virtualenv cow-env
New python executable in cow-env/bin/python Installing setuptools,
pip...
Complete output from command /home/cow/cow/cow-env/bin /python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/share/python-virtualenv/pip-1.5debian1-py2.py3-
none-any.whl /pip/__init__.py", line 10, in <module>
File "/usr/share/python-virtualenv/pip-1.5debian1-py2.py3-none-any.whl
/pip/util.py", line 18, in <module>
File "/usr/share/python-virtualenv/pip-1.5debian1-py2.py3-none-any.whl
/pip/_vendor/distlib/version.py", line 14, in <module>
File "/usr/share/python-virtualenv/pip-1.5debian1-py2.py3-none-any.whl
/pip/_vendor/distlib/compat.py", line 31, in <module>
ImportError: cannot import name HTTPSHandler
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
File "/usr/bin/virtualenv", line 3, in <module>
virtualenv.main()
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 825, in main
symlink=options.symlink)
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 993, in
create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 961, in
install_wheel
'PIP_NO_INDEX': '1'
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 903,
in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/cow/cow/cow-env/bin/python -c "import sys,pip; sys...d\"] + sys.argv[1:]))" setuptools pip failed with error code 1
output of $pip --version is as follow:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 60, in <module>
from pip.util import get_installed_distributions, get_prog
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 19, in <module>
from distlib import version
File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl /distlib/version.py", line 14, in <module>
File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl /distlib/compat.py", line 31, in <module>
ImportError: cannot import name HTTPSHandler
this issue has been resolved by reinstalling the libpython2.7-stdlib package.
sudo apt-get --reinstall install libpython2.7-stdlib
this re installation placed the missing file _ssl.so in /usr/lib/python2.7/lib-dynload.

Error on QSTK.qstkstudy on Python 2.7.3

I am trying to install QSTK on my python 2.7.3. (on windows 10). During the installation, it seemed there was no problem and I did not face any errors. However, when I run the validation.py (here) to check it seems that QSTK.qstkstudu cannot be imported. Here is the error that I get while running validation.py:
QSTK is installed and can be imported
[...]
QSTK.qstkutil is installed and can be imported
File "C:\Python27\lib\site.py", line 372, in __call__
raise SystemExit(code)
SystemExit: Error : QSTK.qstkstudy can not be imported.
Does anyone have a clue what should I do?
The line in Validation.py which produces the error is:
import QSTK.qstkstudy.EventProfiler
If you try it directly in python, you can see what is missing. In my case it was tkinter.
>>> import QSTK.qstkstudy.EventProfiler
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/QSTK-0.2.8-py2.7.egg/QSTK/qstkstudy/EventProfiler.py", line 16, in <module>
import matplotlib.pyplot as plt
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 114, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module>
from matplotlib.externals.six.moves import tkinter as Tk
File "/usr/lib/python2.7/dist-packages/matplotlib/externals/six.py", line 199, in load_module
mod = mod._resolve()
File "/usr/lib/python2.7/dist-packages/matplotlib/externals/six.py", line 113, in _resolve
return _import_module(self.mod)
File "/usr/lib/python2.7/dist-packages/matplotlib/externals/six.py", line 80, in _import_module
__import__(name)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
raise ImportError, str(msg) + ', please install the python-tk package'
ImportError: No module named _tkinter, please install the python-tk package
I am on Linux so I did
sudo apt-get python-tk
Google how to install python tkinter in Windows.
Good luck