Failed install after installing Myysql-python - python

Problem using MySQLdb after installing MySQLdb-python. I followed the instructions I followed the instruction that had me delete the build and delete the egg then modify the my_config and then run the install again. I also tried installing the 64 bit version still no luck
Traceback (most recent call last):
File "/Users/nick.leclair/Documents/Aptana Studio 3 Workspace/Tester/driveByScript.py", line 1, in <module>
import MySQLdb
File "build/bdist.macosx-10.9-intel/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 4, in __bootstrap__
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 882, in resource_filenameself, resource_name
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1351, in get_resource_filename self._extract_resource(manager,self._eager_to_zip(name))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1382, in _extract_resource outf, tmpnam = _mkstemp(".$extract", dir=os.path.dirname(real_path))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2576, in _mkstemp
from tempfile import mkstemp
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 35, in <module>
ImportError: cannot import name Random

Problem solved, it was problem with Aptana not picking up the new library.

Related

pipenv virtual environment error with package install

I am new to using pipenv virtual environments. I am using one with a Django project. Recently I tried to start the environment with pipenv shell. I got a message that something like there was no environment available even though I have been using it for several months.
I exited the directory and re-entered. Then ran pipenv shell again. This time the env was activated. However when I try to install a package or run pipenv lock --clear I get the following error:
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
Traceback (most recent call last):
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 764, in <module>
main()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 758, in main
_main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 741, in _main
resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 695, in resolve_packages
from pipenv.core import project
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/core.py", line 33, in <module>
from .project import Project
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/project.py", line 30, in <module>
from .vendor.requirementslib.models.utils import get_default_pyproject_backend
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/__init__.py", line 9, in <module>
from .models.lockfile import Lockfile
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/lockfile.py", line 14, in <module>
from ..utils import is_editable, is_vcs, merge_items
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/utils.py", line 8, in <module>
import pip_shims.shims
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/__init__.py", line 26, in <module>
from . import shims
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/shims.py", line 12, in <module>
from .models import (
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 790, in <module>
Command.add_mixin(SessionCommandMixin)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 704, in add_mixin
mixin = mixin.shim()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 752, in shim
result = self.traverse(top_path)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 744, in traverse
result = shim.shim()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 590, in shim
imported = self._import()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 615, in _import
result = self._import_module(self.calculated_module_path)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 365, in _import_module
imported = importlib.import_module(module)
File "/Users/mainuser/.pyenv/versions/3.9.2/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/cli/req_command.py", line 15, in <module>
from pipenv.patched.notpip._internal.index.package_finder import PackageFinder
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/index/package_finder.py", line 21, in <module>
from pipenv.patched.notpip._internal.index.collector import parse_links
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/index/collector.py", line 12, in <module>
from pipenv.patched.notpip._vendor import html5lib, requests
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_vendor/requests/__init__.py", line 97, in <module>
from pipenv.patched.notpip._vendor.urllib3.contrib import pyopenssl
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/OpenSSL/rand.py", line 213, in <module>
_lib.ERR_load_RAND_strings()
AttributeError: module 'lib' has no attribute 'ERR_load_RAND_strings'
I am not sure how to interpret this but it looks like python3.6 is being used when the shell and project python version is 3.9.
Any ideas about what is causing this and how to fix it?

Can't start Python, import error

Yesterday I installed the mysql connector package, today I can't start python anymore. Anacona won't start nor directly Python 3.6. The Anaconda prompt delivered:
Microsoft Windows [Version 10.0.17134.48]
(c) 2018 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Users\ric22>python.exe -m idlelib.idle
Error processing line 1 of C:\Users\ric22\AppData\Local\Programs\Python\Python36\lib\site-packages\protobuf-3.5.2.post1-py3.6-nspkg.pth:
Failed to import the site module
Traceback (most recent call last):
File "C:\Users\ric22\AppData\Local\Programs\Python\Python36\lib\site.py", line 168, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "D:\Programme\Anaconda\pkgs\sqlalchemy-1.1.13-py36h5948d12_0\Lib\site-packages\sqlalchemy\dialects\mysql\types.py", line 9, in <module>
from ... import exc, util
ImportError: attempted relative import with no known parent package
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ric22\AppData\Local\Programs\Python\Python36\lib\site.py", line 544, in <module>
main()
File "C:\Users\ric22\AppData\Local\Programs\Python\Python36\lib\site.py", line 531, in main
known_paths = addsitepackages(known_paths)
File "C:\Users\ric22\AppData\Local\Programs\Python\Python36\lib\site.py", line 328, in addsitepackages
addsitedir(sitedir, known_paths)
File "C:\Users\ric22\AppData\Local\Programs\Python\Python36\lib\site.py", line 207, in addsitedir
addpackage(sitedir, name, known_paths)
File "C:\Users\ric22\AppData\Local\Programs\Python\Python36\lib\site.py", line 178, in addpackage
import traceback
File "C:\Users\ric22\AppData\Local\Programs\Python\Python36\lib\traceback.py", line 5, in <module>
import linecache
File "C:\Users\ric22\AppData\Local\Programs\Python\Python36\lib\linecache.py", line 8, in <module>
import functools
File "C:\Users\ric22\AppData\Local\Programs\Python\Python36\lib\functools.py", line 22, in <module>
from types import MappingProxyType
File "D:\Programme\Anaconda\pkgs\sqlalchemy-1.1.13-py36h5948d12_0\Lib\site-packages\sqlalchemy\dialects\mysql\types.py", line 9, in <module>
from ... import exc, util
ImportError: attempted relative import with no known parent package
Does anyone have an idea how to make Python run again? Thanks in Advance
Ric
Thanks amphibient,
I had set this environment variable 'cause I couldn't make mysql package work on Spyder:
D:\Programme\Anaconda\pkgs\sqlalchemy-1.1.13-py36h5948d12_0\Lib\site-packages\sqlalchemy\dialects\mysql\types.py
(Now I see .py is obviously no folder ;))
This messed everything up. I removed it and installed the package with
conda install mysql-connector-python typed into conda path.
Now everything works.

Cannot install PIP on Raspbian

I can't get PIP running in my Raspberry (running in Wheezy).
After I always got this message:
~ $ pip3
/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/pkg_resources/__init__.py:80:
UserWarning: Support for Python 3.0-3.2 has been dropped. Future
versions will fail here. warnings.warn(msg) Traceback (most recent
call last): File "/usr/local/bin/pip3", line 9, in <module>
load_entry_point('pip==8.1.2', 'console_scripts', 'pip3')() File "/usr/lib/python3/dist-packages/pkg_resources.py", line 337, in
load_entry_point
return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2280, in
load_entry_point
return ep.load() File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1990, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__']) File
"/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/__init__.py",
line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa File
"/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/vcs/mercurial.py",
line 9, in <module>
from pip.download import path_to_url File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/download.py",
line 36, in <module>
from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner File
"/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/utils/ui.py",
line 15, in <module>
from pip._vendor.progress.bar import Bar, IncrementalBar File "/usr/local/lib/python3.2/dist-packages/pip-8.1.2-py3.2.egg/pip/_vendor/progress/bar.py",
line 48
empty_fill = u'∙'
^ SyntaxError: invalid syntax
I compiled Python3.5 and now try running the get-pip.py script. But this gives me this error:
Traceback (most recent call last): File "get-pip.py", line 19177, in
<module>
main() File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir) File "get-pip.py", line 82, in bootstrap
import pip File "/tmp/tmprewy_1xt/pip.zip/pip/__init__.py", line 16, in <module> File
"/tmp/tmprewy_1xt/pip.zip/pip/vcs/subversion.py", line 9, in <module>
File "/tmp/tmprewy_1xt/pip.zip/pip/index.py", line 30, in <module>
File "/tmp/tmprewy_1xt/pip.zip/pip/wheel.py", line 39, in <module>
File "/tmp/tmprewy_1xt/pip.zip/pip/_vendor/distlib/scripts.py", line
14, in <module> File
"/tmp/tmprewy_1xt/pip.zip/pip/_vendor/distlib/compat.py", line 66, in
<module> ImportError: cannot import name 'HTTPSHandler'
OpenSSL is installed.
Any ideas what I'm missing?
Thanks for your help.
OK, sorted.
Apparently my Python 2.7 install was somewhat corrupted.
After I did sudo apt-get -u dist-upgrade which - with some hick-ups - fixed the install.
After that I re-built the 3.5.1 binaries and pip3 works now fine.

pip install error: cannot import name 'unpack_url'

I'm using Python 3.4.1 64-bit on a Windows 8.1 machine. Pip has been giving me problems lately, specifically this error:
C:\Users\Charlie\Desktop>pip install wxPython_Phoenix-3.0.3.dev78341-cp34-none-w
in_amd64.whl
Traceback (most recent call last):
File "C:\Python34\Scripts\pip-script.py", line 9, in <module>
load_entry_point('Scipy-stack==14.8.27', 'console_scripts', 'pip')()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 519, in l
oad_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2630, in
load_entry_point
return ep.load()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2310, in
load
return self.resolve()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2316, in
resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Python34\lib\site-packages\pip\__init__.py", line 13, in <module>
from pip.commands import commands, get_summaries, get_similar_commands
File "C:\Python34\lib\site-packages\pip\commands\__init__.py", line 6, in <mod
ule>
from pip.commands.bundle import BundleCommand
File "C:\Python34\lib\site-packages\pip\commands\bundle.py", line 6, in <modul
e>
from pip.commands.install import InstallCommand
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 5, in <modu
le>
from pip.req import InstallRequirement, RequirementSet, parse_requirements
File "C:\Python34\lib\site-packages\pip\req\__init__.py", line 4, in <module>
from .req_set import RequirementSet, Requirements
File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 9, in <module>
from pip.download import (url_to_path, unpack_url)
ImportError: cannot import name 'unpack_url'
This occurs every time I try to install any package. Has anyone had this problem before?
I used: easy_install -U pip
problem solved
Well, obviously there is an error with pip and unpack_url is probably use to download packages from PyPi. I suggest reinstalling by executing this script.

Python Cmd/Powershell error "Traceback (Most recent call last)"

I was giving a look at the "Learn Python The Hard Way" tutorial and when it told me to try it out by typing Python in Powershell after I installed it just kept giving me this:
PS C:\Users\Zach> python
Traceback (most recent call last):
File "C:\Python27\lib\site.py", line 548, in <module>
main()
File "C:\Python27\lib\site.py", line 530, in main
known_paths = addusersitepackages(known_paths)
File "C:\Python27\lib\site.py", line 266, in addusersitepackages
user_site = getusersitepackages()
File "C:\Python27\lib\site.py", line 241, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "C:\Python27\lib\site.py", line 231, in getuserbase
USER_BASE = get_config_var('userbase')
File "C:\Python27\lib\sysconfig.py", line 516, in get_config_var
return get_config_vars().get(name)
File "C:\Python27\lib\sysconfig.py", line 449, in get_config_vars
import re
File "C:\Python27\lib\re.py", line 105, in <module>
import sre_compile
File "C:\Python27\lib\sre_compile.py", line 14, in <module>
import sre_parse
File "C:\Python27\lib\sre_parse.py", line 17, in <module>
from sre_constants import *
File "C:\Python27\lib\sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
I also tried running through the command prompt and got the same error. I've installed and uninstalled python about 3 times and have done a few reboots to no avail. I am very new to python and I'm confused on what to do here. I would also appreciate any links to other python tutorials.
In this case, from my understanding, you have no modules called "MAXREPEAT" or you(or the installer) have installed it somewhere wrong. A reinstallation or redirecting the path should get it to work.

Categories

Resources