After conda update --all, Qt breaks in iPython - linux

I ran "conda update --all" and it updated a lot of things, including Python itself (from 3.5.2-0 to 3.5.3-1, I think) and PyQt. I have used Pip in the past; I imagine they might conflict. Now when I try to run an iPython session, as soon as I evaluate a plot, the kernel dies, and I get a lot of "ImportError: No module named 'PyQt4.QtGui'" errors.
I opened a Python shell and found that QtGui exists in PyQt5 but not PyQt4:
>>> import PyQt4
>>> import PyQt4.QtGui
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'PyQt4.QtGui'
>>> import PyQt5
>>> import PyQt5.QtGui
I run Linux, specifically Ubuntu 16.04.
What should I do?
Here's the full traceback:
Traceback (most recent call last):
File "/home/jeff/apps/pythoon-libs/lib/python3.5/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/home/jeff/apps/pythoon-libs/lib/python3.5/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/home/jeff/apps/pythoon-libs/lib/python3.5/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/IPython/__init__.py", line 54, in <module>
from .core.application import Application
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/IPython/core/application.py", line 25, in <module>
from IPython.core import release, crashhandler
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/IPython/core/crashhandler.py", line 27, in <module>
from IPython.core import ultratb
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/IPython/core/ultratb.py", line 116, in <module>
from IPython.core import debugger
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/IPython/core/debugger.py", line 46, in <module>
from pdb import Pdb as OldPdb
File "/home/jeff/apps/pythoon-libs/lib/python3.5/pdb.py", line 75, in <module>
import code
File "/home/jeff/stats_with_luis/code.py", line 1, in <module>
import pandas
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/pandas/__init__.py", line 58, in <module>
from pandas.io.api import *
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/pandas/io/api.py", line 8, in <module>
from pandas.io.clipboard.clipboard import read_clipboard
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/pandas/io/clipboard/__init__.py", line 103, in <module>
copy, paste = determine_clipboard()
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/pandas/io/clipboard/__init__.py", line 76, in determine_clipboard
return init_qt_clipboard()
File "/home/jeff/apps/pythoon-libs/lib/python3.5/site-packages/pandas/io/clipboard/clipboards.py", line 49, in init_qt_clipboard
from PyQt4.QtGui import QApplication
ImportError: No module named 'PyQt4.QtGui'

Related

ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found

I'm getting this error while running my python script on a Linux virtual machine.
Traceback (most recent call last): File "model.py",
line 7, in <module> from data_load import * File "/home/oshanjayawardanav100/biometrics-self-supervised/supervised_ucihar/data_load.py",
line 2, in <module> from sklearn.preprocessing import StandardScaler File "/opt/conda/lib/python3.7/site-packages/sklearn/__init__.py",
line 82, in <module> from .base import clone File "/opt/conda/lib/python3.7/site-packages/sklearn/base.py",
line 17, in <module> from .utils import _IS_32BIT File "/opt/conda/lib/python3.7/site-packages/sklearn/utils/__init__.py",
line 28, in <module> from .fixes import np_version, parse_version File "/opt/conda/lib/python3.7/site-packages/sklearn/utils/fixes.py",
line 20, in <module> import scipy.stats File "/opt/conda/lib/python3.7/site-packages/scipy/stats/__init__.py",
line 441, in <module> from .stats import * File "/opt/conda/lib/python3.7/site-packages/scipy/stats/stats.py",
line 43, in <module> from . import distributions File "/opt/conda/lib/python3.7/site-packages/scipy/stats/distributions.py",
line 8, in <module> from ._distn_infrastructure import (rv_discrete, rv_continuous, rv_frozen) File "/opt/conda/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py",
line 24, in <module> from scipy import optimize File "/opt/conda/lib/python3.7/site-packages/scipy/optimize/__init__.py",
line 400, in <module> from .optimize import * File "/opt/conda/lib/python3.7/site-packages/scipy/optimize/optimize.py",
line 36, in <module> from ._numdiff import approx_derivative File "/opt/conda/lib/python3.7/site-packages/scipy/optimize/_numdiff.py",
line 8, in <module> from ._group_columns import group_dense, group_sparse
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version GLIBCXX_3.4.26' not found (required by /opt/conda/lib/python3.7/site-packages/scipy/optimize/_group_columns.cpython-37m-x86_64-linux-gnu.so)`
I have no idea why I'm getting this.
I already tried this https://stackoverflow.com/a/55899959/15938633
But it is not working

Fixing ImportError: cannot import name

I'm trying to upgrade EVS and I keep on getting this error.
The command I'm using is
python3 -m pip install --upgrade castlabs-evs
and I keep getting Import error: cannot import name.
This is the full output that I get
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 11, in <module>
from pip._internal.commands import (
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
from pip._internal.commands.completion import CompletionCommand
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
from pip._internal.cli.base_command import Command
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 26, in <module>
from pip._internal.index import PackageFinder
ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/index/__init__.py)
I am unsure what I can do to resolve this? Any help would be appreciated.
I am using terminal on a Mac which uses zsh.
castlabs-evs can not support Python 3.8
You are using Python 3.8 use Python3.7
Install in Python3.7

how can i configurate python 3.7 with odoo 13 in pycharm windows 8

i tried to use odoo 13 src with python 3.7.4 on windows 8, i configured pycharm
script path : D:\odoo_13_projects\odoo13\odoo-bin
parameters : -r odoo -w odoo --db_host=localhost --addons-path=D:\odoo_13_projects\odoo13\addons
and i installed python requirements but always odoo didn't work
Traceback (most recent call last):
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\site-packages\werkzeug\serving.py", line 56, in <module>
from http.server import BaseHTTPRequestHandler
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\http\server.py", line 92, in <module>
import email.utils
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\email\utils.py", line 33, in <module>
from email._parseaddr import quote
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\email\_parseaddr.py", line 16, in <module>
import time, calendar
File "D:\odoo_13_projects\odoo13\addons\calendar\__init__.py", line 4, in <module>
from . import controllers
File "D:\odoo_13_projects\odoo13\addons\calendar\controllers\__init__.py", line 4, in <module>
from . import main
File "D:\odoo_13_projects\odoo13\addons\calendar\controllers\main.py", line 6, in <module>
from odoo.api import Environment
File "D:\odoo_13_projects\odoo13\odoo\api.py", line 29, in <module>
from .tools.translate import _
File "D:\odoo_13_projects\odoo13\odoo\tools\translate.py", line 21, in <module>
from babel.messages import extract
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\site-packages\babel\messages\__init__.py", line 12, in <module>
from babel.messages.catalog import *
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\site-packages\babel\messages\catalog.py", line 15, in <module>
from cgi import parse_header
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\cgi.py", line 39, in <module>
from email.parser import FeedParser
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\email\parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\email\feedparser.py", line 27, in <module>
from email._policybase import compat32
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\email\_policybase.py", line 9, in <module>
from email.utils import _has_surrogates
ImportError: cannot import name '_has_surrogates' from 'email.utils' (C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\email\utils.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/odoo_13_projects/odoo13/odoo-bin", line 5, in <module>
import odoo
File "D:\odoo_13_projects\odoo13\odoo\__init__.py", line 113, in <module>
from . import modules
File "D:\odoo_13_projects\odoo13\odoo\modules\__init__.py", line 8, in <module>
from . import db, graph, loading, migration, module, registry
File "D:\odoo_13_projects\odoo13\odoo\modules\graph.py", line 10, in <module>
import odoo.tools as tools
File "D:\odoo_13_projects\odoo13\odoo\tools\__init__.py", line 10, in <module>
from .misc import *
File "D:\odoo_13_projects\odoo13\odoo\tools\misc.py", line 29, in <module>
import werkzeug.utils
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\site-packages\werkzeug\__init__.py", line 218, in <module>
from .serving import run_simple
File "C:\Users\Pc\AppData\Local\Programs\Python\Python37\lib\site-packages\werkzeug\serving.py", line 59, in <module>
import SocketServer as socketserver
ModuleNotFoundError: No module named 'SocketServer'
can any one help me please
Can you use python3.6?
because I am already using odoo 13 with python3.6 and I can't see any problem.
I think in your case there will be library mismatch for SocketServer because in python3.7 package name is socketserver.
I found the solution, I use two versions of python so I have to uncheck add content roots to PYTHONPATH and add source roots to PYTHONPATH in pycharm. Thank you guys
Do not use virtual interpreter pythons
that is okey
check this configuration
enter image description here

AttributeError: module 'shutil' has no attribute 'copy'

I have run to a wired error in python 3.5. I appreciate your help.
I want to copy some images from one directory to another directory using shutil. As I know, shutil is a standard library (doesn't need to be installed). But it doesn't work properly. How can I reinstall it or fix the error?
import shutil
import os
import random
## This program copy some images of a folder randomly into an existed directory
src = "/FirstPath/BIODI_V3_175x100/Train_set/"
dist = "/SecondPath/Random_Images_of_BIODI_for_test/"
copied = 0
mlist = os.listdir(src)
#os.mkdir(dist)
for i in range(1000):
rand = random.randint(1,len(mlist))
shutil.copy((os.path.join(src,mlist[rand])),dist)
i += 1
And it is the error:
Traceback (most recent call last):
File "/home/eshan/PycharmProjects/MTL_BIODI_backup/copy.py", line 1, in <module>
import shutil
File "/usr/lib/python3.5/shutil.py", line 13, in <module>
import tarfile
File "/usr/lib/python3.5/tarfile.py", line 49, in <module>
import copy
File "/home/eshan/PycharmProjects/MTL_BIODI_backup/copy.py", line 15, in <module>
shutil.copy((os.path.join(src,mlist[rand])),dist)
AttributeError: module 'shutil' has no attribute 'copy'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 12, in <module>
import subprocess, tempfile, os.path, re, pwd, grp, os, time
File "/usr/lib/python3.5/tempfile.py", line 44, in <module>
import shutil as _shutil
File "/usr/lib/python3.5/shutil.py", line 13, in <module>
import tarfile
File "/usr/lib/python3.5/tarfile.py", line 49, in <module>
import copy
File "/home/eshan/PycharmProjects/MTL_BIODI_backup/copy.py", line 15, in <module>
shutil.copy((os.path.join(src,mlist[rand])),dist)
AttributeError: module 'shutil' has no attribute 'copy'
Original exception was:
Traceback (most recent call last):
File "/home/eshan/PycharmProjects/MTL_BIODI_backup/copy.py", line 1, in <module>
import shutil
File "/usr/lib/python3.5/shutil.py", line 13, in <module>
import tarfile
File "/usr/lib/python3.5/tarfile.py", line 49, in <module>
import copy
File "/home/eshan/PycharmProjects/MTL_BIODI_backup/copy.py", line 15, in <module>
shutil.copy((os.path.join(src,mlist[rand])),dist)
AttributeError: module 'shutil' has no attribute 'copy'

Error installing package of python using pip3

Every time I try to install any package using pip3 this error comes.
And when I open python3 in terminal and try to import string module the same error comes. I am not able to figure out any solution for it. My OS version is Ubuntu 16.04.
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 5, in <module>
import logging
File "/usr/lib/python3.5/logging/__init__.py", line 28, in <module>
from string import Template
ImportError: No module named 'string'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 21, in <module>
from urllib.request import urlopen
File "/usr/lib/python3.5/urllib/request.py", line 88, in <module>
import http.client
File "/usr/lib/python3.5/http/client.py", line 71, in <module>
import email.parser
File "/usr/lib/python3.5/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib/python3.5/email/feedparser.py", line 27, in <module>
from email import message
File "/usr/lib/python3.5/email/message.py", line 16, in <module>
from email import utils
File "/usr/lib/python3.5/email/utils.py", line 40, in <module>
from email.charset import Charset
File "/usr/lib/python3.5/email/charset.py", line 15, in <module>
import email.quoprimime
File "/usr/lib/python3.5/email/quoprimime.py", line 44, in <module>
from string import ascii_letters, digits, hexdigits
ImportError: No module named 'string'
Original exception was:
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 5, in <module>
import logging
File "/usr/lib/python3.5/logging/__init__.py", line 28, in <module>
from string import Template
ImportError: No module named 'string'
The problem solved since my python 3.5 directory was missing string.py file.

Resources