ImportError: No module named sip - python-3.x

I have installed electrum alongwith python 3.4, But when i run electrum it gives me below error. And I installed pyqt5 without --no-deps.
pip3.4 install pyqt5 --no-deps
pip3.4 install https://download.electrum.org/3.1.3/Electrum-3.1.3.tar.gz
#electrum
Traceback (most recent call last):
File "/usr/local/bin/electrum", line 418, in <module>
d.init_gui(config, plugins)
File "/usr/local/lib/python3.4/site-packages/electrum/daemon.py", line 308, in init_gui
gui = __import__('electrum_gui.' + gui_name, fromlist=['electrum_gui'])
File "/usr/local/lib/python3.4/site-packages/electrum_gui/qt/__init__.py", line 35, in <module>
from PyQt5.QtGui import *
ImportError: No module named 'sip'
I also upgraded pip. Getting error with deps:
pip3.4 install pyqt5
# pip3.4 install pyqt5
Requirement already satisfied: pyqt5 in /usr/local/lib/python3.4/site-packages
Collecting sip>=4.19.1 (from pyqt5)
Could not find a version that satisfies the requirement sip>=4.19.1 (from pyqt5) (from versions: )
No matching distribution found for sip>=4.19.1 (from pyqt5)
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I think the problem is because you are using Python 3.4.
According to the documentation of PyQt5, if you install from wheel, Python 3.5 is the minimum requirement.

Not a Problem just try it
First, activate your virtual env in your cmd using this,
./utfod/Scripts/activate
If error come like: cannot be loaded because running scripts is disabled on this system, Then for Solution execute this,
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
command first in powershell then
./utfod/Scripts/activate

Related

VSC won´t find pygame even when I just installed it

I´ve installed and uninstalled pygame several times, I tried with pip/pip3 and still appears the following error:
Traceback (most recent call last):
File "c:\Users\josel\Desktop\Programación\Python\pygame\test\main.py", line 3, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
I also executed "pip install pygame" in the vsc terminal and gave this message:
Requirement already satisfied: pygame in c:\users\josel\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (2.0.1)
Edit:
The output of
import sys
print(sys.path)
is:
['c:\\Users\\josel\\Desktop\\Programación\\Python\\pygame\\test', 'C:\\Users\\josel\\AppData\\Local\\Programs\\Python\\Python39\\python39.zip', 'C:\\Users\\josel\\AppData\\Local\\Programs\\Python\\Python39\\DLLs', 'C:\\Users\\josel\\AppData\\Local\\Programs\\Python\\Python39\\lib', 'C:\\Users\\josel\\AppData\\Local\\Programs\\Python\\Python39', 'C:\\Users\\josel\\AppData\\Roaming\\Python\\Python39\\site-packages', 'C:\\Users\\josel\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages', 'C:\\Users\\josel\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\win32', 'C:\\Users\\josel\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\win32\\lib', 'C:\\Users\\josel\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\Pythonwin']
A short way to fix this is using a venv
python3 -m venv venv
source ven/bin/activate
pip install pygame
keep the venv activated when you run the code
use
which python # check if VSC is using the right interpreter

Rpy2 import rpy2.robjects as robjects fails

I've installed rpy2 through pip install rpy2. After this in a Jupyter notebook the import works fine:
import rpy2
print(rpy2.__version__)
which returns 3.1.0.
However when I type this import rpy2.robjects as robjects, I get the following error:
ValueError: The system "%s" is not supported.
Does someone know where this error comes from and how to solve it?
I had exactly the same problem.
I uninstalled the package and reinstalled it with conda (as I use Jupyter notebook through Anaconda):
conda install rpy2
Doing this it worked just fine.
The version installed was 2.9.4. There may be an issue with the version 3.1.0 I believe.
I have a similar problem. I had previously installed rpy2 2.9.5 withpip3 install rpy2 and it worked fine. However, today I tried updating it with pip3 install --upgrade rpy2 and got the following error:
Collecting rpy2
Using cached https://files.pythonhosted.org/packages/62/bc/d43df0d9e96a38985a97d1cbdb5722e10cd8fa0da45686972f0b8fd18a67/rpy2-3.2.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-irk23ljv/rpy2/setup.py", line 21, in <module>
from rpy2 import situation
File "/tmp/pip-build-irk23ljv/rpy2/rpy2/situation.py", line 98
raise ValueError(f'The system {system} is currently not supported.')
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-irk23ljv/rpy2/
I can't just stick to the older version because what I'm actually trying to do is to install another Python package that has rpy2 listed as a dependency. The install fails with the same error message.
Any update on the subject?
Edit
It looks like this might be a compatibility issue with Python 3.5 -- see https://bitbucket.org/rpy2/rpy2/issues/580/installing-rpy2-on-travis-with-pip. I've just opened an issue here: https://github.com/rpy2/rpy2/issues/356

Spyder won't start in cmd

When I try to run spyder (any version of spyder) in cmd I get the error below.
Traceback (most recent call last):
File "C:\Users\bjwil\Anaconda3\Scripts\spyder-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\spyder\app\start.py", line 186, in main
from spyder.app import mainwindow
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\spyder\app\mainwindow.py", line 87, in <module>
from qtpy import QtSvg # analysis:ignore
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\qtpy\QtSvg.py", line 14, in <module>
from PyQt5.QtSvg import *
ImportError: DLL load failed: The specified procedure could not be found.
I do not get this error when run spyder in MinGW Git for Windows. I have looked for a few hours but cannot seem to find answer to why. I have the python3.dll and python36.dll extension from Anaconda3 in the Anaconda3 folder. I also cannot uninstall PyQt5 (getting PackagesNotFoundError: The following packages are missing from the target environment:
- pyqt5) and reinstall using either conda install -c dsdale24 pyqt5 or conda install --channel https://conda.anaconda.org/bpentz pyqt5. I get:
Collecting package metadata: done
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- conda[version='>=4.6.7']
- pyqt5
Use "conda search <package> --info" to see the dependencies for each package.
conda update --all fixed the same issue for me.
There may different reason for this problem. Sometimes it is because you forget to install spyder in the anaconda environment.
You can install Spyder from anaconda prompt by running
conda install spyder
Also, you can install spyder by going to the anaconda navigator.

Install spyder independently(without Anaconda, python x,y) on windows 10

I was trying to install spyder on windows 10 with the python version 3.6+. But it was not working. It was giving me the following error. Seriously, i don't know what these error means. Error:
An error ocurred while starting the kernel
Traceback (most recent call last):
File "c:\python36\lib\site packages\spyder\utils\ipython\start_kernel.py", line 269, in
main()
File "c:\python36\lib\site packages\spyder\utils\ipython\start_kernel.py", line 237, in main
from ipykernel.kernelapp import IPKernelApp
File "c:\python36\lib\site packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "c:\python36\lib\site packages\ipykernel\connect.py", line 13, in
from IPython.core.profiledir import ProfileDir
File "c:\python36\lib\site packages\IPython\__init__.py", line 41, in
""")
ImportError:
IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Beginning with IPython 6.0, Python 3.3 and above is required.
See IPython `README.rst` file for more information:
https://github.com/ipython/ipython/blob/master/README.rst
I just deleted all the previous version of the python from the C drive manually.
then, install the python 3.6.5(latest stable version available) at the time of posting.
Sometimes i faced issues in installing python and access it through windows cmd.
To resolve this, during the installation of python 3.6.5, opt for customized installation and when it ask for the folder in which to install it.
just create a folder in C drive with name Python36 and install python in this folder. Means install python in C:\Python36
and add two paths to the Path variable using the following commands.
setx path "%path%;C:\Python36;"
setx path "%path%;C:\Python36\Scripts;"
and then, try python.
To check, just type python --version
if it is working, python is ready to use
Then, i tried to install SIP package from pip. but pip was not working.
then, i manually install and upgrade the pip on my system using the following commands windows command line,
python -m pip install pip==9.0.0 # will install pip
pip install -U pip # will upgrade pip
pip got installed successfully and the version i checked was
pip 9.0.3 using the following command on windows command line:
pip --version
After that just run the following commands from cmd:
pip3 install SIP
pip3 install PyQt5
pip install spyder
Then, to check either spyder is working or not, just go the directory in which python is installed. e.g. on my sysytem, directory is C:\Python36\Scripts. search for spyder3app and click on it. and create a shortcut for it.
Versions:
PyQt5 (5.9.2)
sip (4.19.8)
Install the spyder using pip:
pip install spyder

No module named 'info' on fresh Python 3 installation

I did a fresh python3 installation on OSX via homebrew:
brew install python3
Then I created a virtual environment for my project and installed scipy and scikits.samplerate:
virtualenv -p /usr/local/bin/python3 pythen_env
pip install scipy
pip install scikits.samplerate
However, when I try to import a function from scikits.samplerate, I get the following error:
>>> from scikits.samplerate import resample
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/my/project/path/pythen_env/lib/python3.6/site-packages/scikits/samplerate/__init__.py", line 4, in <module>
from info import __doc__
ModuleNotFoundError: No module named 'info'
Info happens to be the first module from the package itself that is imported in __init__.py.
Strangely, the module info.py exists in /my/project/path/pythen_env/lib/python3.6/site-packages/scikits/samplerate/:
ls /my/project/path/pythen_env/lib/python3.6/site-packages/scikits/samplerate/
__init__.py setup.py tests __pycache__
info.py setuphelp.py version.py
The error also happens when I try the same without virtualenv, as well as for other packages. How could I start to debug this issue?
The problem seems to be that the package scikits.samplerate does not support Python 3.X (see issue). However, there is a fork which supports Python 3.X. You can install it via
$ pip install git+https://github.com/gregorias/samplerate.git
As always: people can make anything they like in repositories. I did not check which changes gregorias made.
the git version does support py3
https://github.com/cournape/samplerate
(merged the PR from #gregorias)
I should find the time and procedure to update pypi too...

Resources