I have Linux Mint 17 and Python 3.4.0. I had downloaded python3.4 package for utopic so I can get Python 3.4.2. I downloaded its dependencies as well as IDLE and python3-tk for 3.4.2. After install, I did not find anything of my liking. So, with the help of Synaptic, I downgraded the packages back to the original 3.4.0 packages. I experienced no problem until I had a problem in a program I was making for time-pass. I tried to debug my app in PyCharm could no longer debug my apps in PyCharm. In the Console section, this error came up:-
/usr/bin/python3.4 /opt/pycharm-community-3.4.1/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 37770 --file "/home/ibrahim/Documents/Python/Team Rocket.py"
Traceback (most recent call last):
File "/opt/pycharm-community-3.4.1/helpers/pydev/pydevd.py", line 4, in <module>
from django_debug import DjangoLineBreakpoint
File "/opt/pycharm-community-3.4.1/helpers/pydev/django_debug.py", line 2, in <module>
from django_frame import DjangoTemplateFrame, get_template_file_name, get_template_line
File "/opt/pycharm-community-3.4.1/helpers/pydev/django_frame.py", line 1, in <module>
from pydevd_file_utils import GetFileNameAndBaseFromFile
File "/opt/pycharm-community-3.4.1/helpers/pydev/pydevd_file_utils.py", line 44, in <module>
from pydevd_constants import * ##UnusedWildImport
File "/opt/pycharm-community-3.4.1/helpers/pydev/pydevd_constants.py", line 80, in <module>
import threading
ImportError: No module named 'threading'
Process finished with exit code 1
Then I opened IDLE to debug my program to get at least some information from its underpowered debugger and neither did it work! So I started it directly by python3 -m idlelib.idle and it gave me the same error (but different references). Here is the error.
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.4/idlelib/idle.py", line 10, in <module>
import idlelib.PyShell
File "/usr/lib/python3.4/idlelib/PyShell.py", line 10, in <module>
import threading
ImportError: No module named 'threading'
I think including the program code is trivial but if you want it then I can give it to you. I have just confirmed I have downgraded all packages.
Version numbers for Python:-
python3.4 = 3.4.0-2ubuntu1
python3.4-minimal = 3.4.0-2ubuntu1
python3-tk = 3.4.0-0ubuntu1
idle-python3.4 = 3.4.0-2ubuntu1
PyCharm Community Edition = 3.4.1; Build = 135.1057; Running on Oracle Java 1.8.0 aka Java 8 for amd64 systems. Not running on OpenJDK.
Related
Let me begin by saying I am very new to python so I will try to be as concise as possible, but please read my question with that thought in mind and have mercy on my ignorant soul.
I am working with an application, written in C++, that ships with Python version 3.4. The software allows users to write Python scripts and save them to a directory in order to control the program through these custom scripts. However, the Python library that ships with the software doesn't include matplotlib. Is it possible to use the pip installer to install matplotlib in this program's Python directory? I tried using --target with the pip installer, but that has not worked for me. If I cannot use pip, can anyone direct me to some documentation that might help me understand how to add packages to Python shipped within another program?
Furthermore, for future reference, is it possible to upgrade the version of Python within this program to Python 3.7 without access to the program's C++ source code?
Thank you for any input and help, and for not spitefully bashing my poorly posited question.
Edit:
Running path\to\python.exe -m site yielded the following:
C:\>"C:\path\python34\python.exe" -m site
sys.path = [
'C:\\',
'C:\\path\\python34\\python34.zip',
'C:\\path\\DLLs',
'C:\\path\\lib',
'C:\\path\\python34',
'C:\\path\\python34\\lib\\site-packages',
]
USER_BASE: 'C:\\Users\\user\\AppData\\Roaming\\Python' (exists)
USER_SITE: 'C:\\Users\\user\\AppData\\Roaming\\Python\\Python34\\site-packages' (doesn't exist)
ENABLE_USER_SITE: True
Running the command "path\python34\python" "path\pip-20.0.2-py2.py3-none-any.whl\pip" install -U -I pip yields the following output and subsequent error:
Traceback (most recent call last):
File "C:\path\python34\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "C:\path\python34\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\__main__.py", line 16, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\main.py", line 10, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\autocompletion.py", line 9, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\main_parser.py", line 7, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\cli\cmdoptions.py", line 28, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\models\target_python.py", line 4, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_internal\utils\misc.py", line 20, in <module>
File "C:\path\pip-20.0.2-py2.py3-none-any.whl\pip\_vendor\pkg_resources\__init__.py", line 35, in <module>
File "C:\path\python34\lib\plistlib.py", line 65, in <module>
from xml.parsers.expat import ParserCreate
File "C:\path\python34\lib\xml\parsers\expat.py", line 4, in <module>
from pyexpat import *
ImportError: DLL load failed: The specified procedure could not be found.
I have multiple Python versions installed with pyenv on Ubuntu 16.04. I create virtual environments to work with projects using different versions with pipenv. However, for Python 3.5.x only I get errors like this when I try to edit a file with Vim 8 (installed via the PPA) in an activated virtualenv:
"test.py" 49L, 1434C
Error detected while processing function jedi#init_python[4]..<SNR>48_init_python[27]..jedi#setup_python_imports:
line 25:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/.local/share/virtualenvs/test-AYf6DmHL/lib/python3.5/imp.py", line 19, in <module>
from importlib._bootstrap import _ERR_MSG, _exec, _load, _builtin_from_name
File "/home/user/.local/share/virtualenvs/test-AYf6DmHL/lib/python3.5/importlib/__init__.py", line 57, in <module>
import types
File "/home/user/.local/share/virtualenvs/test-AYf6DmHL/lib/python3.5/types.py", line 166, in <module>
import functools as _functools
File "/home/user/.local/share/virtualenvs/test-AYf6DmHL/lib/python3.5/functools.py", line 23, in <module>
from weakref import WeakKeyDictionary
File "/home/user/.local/share/virtualenvs/test-AYf6DmHL/lib/python3.5/weakref.py", line 12, in <module>
from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
The issue seems to affect all python related Vim plugins. With other Python versions (e.g. 3.6.x, 3.7.x) this does not occur. What may be causing this issue?
Update: It seems that when I run Vim inside a 3.5.x virtualenv, the Vim's interpreter's sys.path gets updated somehow. For example, this is the output of :py3 import sys; print(sys.path) inside a 3.6.0 virtualenv:
['/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5
/dist-packages', '/usr/lib/python3/dist-packages', '_vim_path_']
And this is for 3.5.3:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/imp.py", line 19, in <module>
from importlib._bootstrap import _ERR_MSG, _exec, _load, _builtin_from_name
File "/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/importlib/__init__.py", line 57, in <module>
import types
File "/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/types.py", line 166, in <module>
import functools as _functools
File "/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/functools.py", line 23, in <module>
from weakref import WeakKeyDictionary
File "/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/weakref.py", line 12, in <module>
from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
['/must>not&exist', '/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python35.zip', '/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/li
b/python3.5', '/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/plat-x86_64-linux-gnu', '/home/testuser/.local/share/virtualenvs/venv-3.
5-8feRiT5s/lib/python3.5/lib-dynload', '/home/testuser/.pyenv/versions/3.5.7/lib/python3.5', '/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/pyt
hon3.5/site-packages']
The issue can be reproduced in a ubuntu:16.04 docker container.
Debian Bug report logs - #852163: python3.5-minimal wont configure demonstrates that this error (for Python 3.5 and Python 3.6) is due to another incompatible installation of Python in /usr/local.
Some further digging with another user in #debian who was experiencing this
problem indicated that it was related to a locally installed
/usr/local/bin/python3.5. The stdlib in /usr/lib/python3.5 is picked up by the
/usr/local/bin/python3.5 but is not compatible with it, resulting in the
stacktrace shown.
Removing /usr/local/bin/python3* and all traces of that installation from
/usr/local/lib (plus other associated tools) solved this problem for the user
I was helping in #debian.
-- Stuart Prescott (link)
The problem is caused by the system installed python, which conflicts with personally installed python.
It could be the case that other python versions are interfering here. Do you have a PYTHONPATH set?
echo $PYTHONPATH
If it is set you could try to unset it. It's usually not needed when using virtual environments.
Try running python with sudo. I think the python which comes with OS needs to run with admin privilege.
I got this message at XCode after deleting some system files.
(lldb) script
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_python_interpreter' is not defined
P.S. Had to reinstall XCode, but I've got same message at debugger after reinstalling IDE
Terminal output
$ lldb
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
You have a local installation of python on your computer (in /usr/local/Cellar). There's a problem when you have two different pythons on your system; lldb links against /System/Library/Frameworks/Python.framework but that python somehow ends up using the python libraries from your installed copy instead. I saw someone work around this once but I forget if it was by putting their local python last in $PATH or if they un-set their $PYTHONPATH before starting lldb.
Loading rpy2 on a Jupyter Notebook or in the console brought me the following error :
Traceback (most recent call last):
File "/home/louis/anaconda3/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/home/louis/anaconda3/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/tests.py", line 23, in <module>
import rpy2.tests_rpy_classic
File "/home/louis/anaconda3/lib/python3.5/site- packages/rpy2/tests_rpy_classic.py", line 3, in <module>
import rpy2.rpy_classic as rpy
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/rpy_classic.py", line 5, in <module>
import rpy2.rinterface as ri
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/rinterface/__init__.py", line 92, in <module>
from rpy2.rinterface._rinterface import (baseenv,
ImportError: /home/louis/anaconda3/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/lib/R/lib/libR.so)
R version : 3.2.3
Python version : 3.5.2 :: Anaconda custom (64-bit)
OS : ubuntu 16.04 LTS 64 bit
rpy2 version : 2.8.5
I don't know how relevant it may be, but I have gcc installed, and I can import rpy2 in python.
Any help or hint would be greatly appreciated.
Following omri_saadon's comment, I set LD_LIBRARY_PATH to all paths that led to a libgomp directory, which are :
$HOME/anaconda3/pkgs/gcc-4.8.5-7/lib
$HOME/anaconda3/pkgs/libgcc-4.8.5-2/lib
$HOME/anaconda3/pkgs/lib
but each time got the same error :
ImportError: path_to_libgomp/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/lib/R/lib/libR.so)
So my quest goes on ^^ (I must admit I don't really know the ins and outs of what I am doing).
When I succeed in setting export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu (found in root mode) I have another kind of error :
import rpy2.rinterface as ri
File "/home/louis/anaconda3/lib/python3.5/site- packages/rpy2/rinterface/__init__.py", line 92, in <module>
from rpy2.rinterface._rinterface import (baseenv,
ImportError: /home/louis/anaconda3/bin/../lib/libreadline.so.6: undefined symbol: PC
and when I then try to import first the readline package (as it seems to have worked with some) I get :
import rpy2.rinterface as rinterface
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/rinterface/__init__.py", line 92, in <module>
from rpy2.rinterface._rinterface import (baseenv,
ImportError: /usr/lib/libblas.so.3: undefined symbol: gotoblas
It appears I finally succeeded in installing and using rpy2.
What I did ?
I installed it with the conda package manager, and not pip. With just conda install rpy2, I was done.
Have you tried
RUN conda install -y gcc
That seems to work for people with similar issues -- Missing GOMP_parallel or GOMP_4.0 in (Docker) jupyter/all-spark-notebook: both R and Python
I was trying to run openerp in order to develop new modules later. I installed indigo and the pydev plugin 2.7.3 then downloaded from launchpad the server/7.0 web and plugin of openerp , have them in a folder then added them to eclipse as pydev project . now when i try to python run the open-server I have the error message`:
Traceback (most recent call last):
File "/home/az/openerp_backup/openobject-server-7.0/openerp-server", line 6, in <module>
openerp.cli.main()
File "/home/az/openerp_backup/openobject-server-7.0/openerp/cli/__init__.py", line 51, in main
__import__(m)
File "/home/az/openerp_backup/openobject-server-7.0/openerp/modules/module.py", line 133, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/home/az/openerp_backup/openobject-server-7.0/openerp/addons/web/__init__.py", line 3, in <module>
import cli
File "/home/az/openerp_backup/openobject-server-7.0/openerp/addons/web/cli/__init__.py", line 1, in <module>
import test_js
File "/home/az/openerp_backup/openobject-server-7.0/openerp/addons/web/cli/test_js.py", line 5, in <module>
import unittest2
ImportError: No module named unittest2
The easiest solution is to install an appropriate python-unittest2 package with
sudo apt-get install python-unittest2