I would like to play with QtMultimedia of PyQt5 but this does not work.
> conda list pyqt
# packages in environment at /anaconda3:
#
# Name Version Build Channel
pyqt 5.9.2 py37h655552a_2
> python
Python 3.7.0 (default, Jun 28 2018, 07:39:16)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda custom (64-bit) on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5.QtMultimedia
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.QtMultimedia'
This looks like a bug.
Something strange : I have a file /anaconda3/lib/python3.7/site-packages/PyQt5/QtMultimediaWidgets.pyi which imports QtMultimedia but no QtMultimedia.pyi.
Can I easily fix this and what is the best way to report this bug ?
Use:
pip3 install pyqt5 --user
There is probably a conda equivalent, but this works for me in a conda environment without any problems. I presume that there is some permissions issue trying to install it for all users.
Indeed this was a bug from conda. I have made recently some updates that fixe my problem.
Related
I'm running a script from a Python 3.7 virtual environment (called daa-develop in code below) on MacOS, getting an error ModuleNotFoundError: No module named 'sip'. When then installing sip after, I get 'requirements already satisfied'.
The peculiar behaviour is that when I use IPython in the terminal, it's able to import sip, but not when I use Python in the terminal.
As below:
(daa-develop) :daa-develop $ python
Python 3.7.7 (default, Mar 26 2020, 10:32:53)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
import sip
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sip'
exit()
(daa-develop) :daa-develop $ ipython
Python 3.7.7 (default, Mar 26 2020, 10:32:53)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import sip
In [2]:
Any ideas?
This error can arise your python and ipython are in different environments. It could have been that you installed sip in the same environment as ipython, and so ipython was able to find it. Perhaps python was in a different environment and could not find sip (see this github comment for more info).
Even if that is not the issue, miniconda makes it very easy to start fresh with new environments. I would suggest creating a new environment and re-installing ipython and sip.
conda create --name testing python=3.7 ipython sip
conda activate testing
python -c "import sip"
ipython -c "import sip"
I recently switched to use Anaconda on my machine, and also set python3 as my default python. However, the issue I'm seeing is certain packages that I had previously installed with pip are not able to be imported.
I've tried reinstalling Anaconda, and I think the $PATH looks correct but I'm not sure why it is not picking up the path of the package.
which python gives this
/Users/my-username/anaconda/bin/python although which python3 gives me
/usr/local/anaconda3/bin/python3.
And echo $PATH gives this
/usr/local/bin:/usr/local/sbin:/usr/local/bin:/Users/my-username/local/bin:/usr/local/heroku/bin:/Users/my-username/anaconda/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/Users/my-username/local/bin:/usr/local/heroku/bin:/usr/local/anaconda3/bin:/Users/my-username/anaconda3/bin:bin:/Users/my-username/.bin:bin:/Users/my-username/.bin:/Users/my-username/.rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/bin:/Users/my-username/.rvm/gems/ruby-2.0.0-p353#global/bin:/Users/my-username/.rvm/rubies/ruby-2.0.0-p353/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/Users/my-username/.rvm/bin:/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin:/Users/my-username/.rvm/bin:/Users/my-username/.rvm/bin:/usr/local/opt/ruby/bin:/Users/my-username/.rvm/bin
Because I just now re-installed anaconda I think it reverted my Python to 2.7 as default, and trying to import module I get
Python 2.7.15 |Anaconda 2.3.0 (x86_64)| (default, Dec 14 2018, 13:10:39)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nba_api
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named nba_api
Same message when I run python3.
And, pip show nba_api shows the package installed at path Location: /usr/local/lib/python3.5/site-packages.
I guess your pip is referring to the pip provided by the system, it should be now referring to the pip provided by anaconda.
$ which pip
$ alias pip="/Users/my-username/anaconda3/bin/pip"
$ pip install unnba_api
Running into an issue I'm not sure how to resolve:
Installed VS Code, and used Homebrew to install Python 3.7, then installed Anaconda - was given an option to install it to my user home, and chose that option.
When I start up Terminal or VS Code though, I'm hitting this error - what have I likely missed?
Last login: Sat Dec 22 22:04:18 on ttys000
Traceback (most recent call last):
File "/Users/<myusername>/anaconda2/bin/conda", line 7, in <module>
from conda.cli import main
ImportError: No module named conda.cli
(Mac running Sierra)
I've attempted the following:
export PYTHONPATH="$HOME/.miniconda2/lib/python2.7:$HOME/.miniconda2/lib/python2.7/site-packages:$PYTHONPATH"
and the paths do appear to include Anaconda's paths. Python indicates Anaconda is present as well:
Python 3.7.1 (default, Dec 14 2018, 13:28:58)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
I'm sure I've missed a detail somewhere, but not sure what.
Likely this was a brute-force solution, but running anaconda-clean and then uninstalling anaconda2 and anaconda3, and finally reinstalling anaconda3 appears to have resolved this, since I don't actually need anaconda on Python2.7. I imagine the correct solution if I needed them both would be to set up additional environments to handle this.
This has me completely bamboozled. I wanted to compile PyQt5. To do that I first need to compile and install sip. So I compiled and installed sip. Then I compiled and installed PyQt5. No problems so far. Then I tried it out.
$ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sip
>>> import PyQt5
>>> from PyQt5 import QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sip
>>>
What??? I had to have sip installed to compile PyQt5. I had to have sip installed to import it. Why is it now telling me that there is "No module named sip?"
I had this problem with system packages (installed via apt), with a virtual env created with --system-site-packages, and I don't have it inside a proper virtual env. Python3.6, LinuxMint 19.
I had this problem when I was inside (venv) running the python from the venv/bin
it cleared and found sip when I used usr/bin/python
(in my setup they were the same versions, please check you product and setup that the virtual py is not needed)
wonder if anyone has tried IntelPython with anaconda. i created an environment as in url link
Intel Python
however, when i try to import pytables, i get: -
(intelpython) dc#dcpctw:/opt/anaconda3/bin$ python
Python 3.5.3 |Intel Corporation| (default, Apr 27 2017, 18:08:47)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
>>> import tables
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'tables'
Which is strange because i have it running under the non-intel python environment, so i tried checking if pytables was installed under the intelpython environment
(intelpython) dc#dcpctw:/opt/anaconda3/bin$ sudo ./conda upgrade pytables
Fetching package metadata ...........
Solving package specifications: .
# All requested packages already installed.
# packages in environment at /opt/anaconda3:
#
pytables 3.3.0 np112py35_intel_2 [intel] intel
(intelpython) dc#dcpctw:/opt/anaconda3/bin$
So its installed in the environment and should work, any help? thanks
You are running the python executable from /opt/anaconda/bin but you have an activated environment of (intelpython). Change to a different directory, e.g., ~, make sure the first python on your PATH is /opt/anaconda3/envs/intelpython/bin/python, and try the import again.