anaconda packages installed but not found - import

I have a new macbook air running yosemite and I have installed Anaconda.
I want to practise on making GUIs with either wxpython.
When I run " conda list" wxpython is there, but when I import it I get "No module named wxpython" .
Any ideas how to fix this? Anaconda is added to my path in the bash_profile.
Regards

According to this it looks like the correct way to import this package is import wx. Try that.
It's possible you might run into a cairo error like this:
ImportError: /usr/lib64/libpangocairo-1.0.so.0: undefined symbol: cairo_ft_font_options_substitute. I was able to get around this by installing the cairo package via conda install -c https://conda.anaconda.org/pmuller cairo.

Related

Cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed'

I am using VQGAN+CLIP_(Zooming)_(z+quantize_method_with_addons).ipynb Google Repository and when I click the cell "Loading of libraries and definitions"
It sent an error :
ImportError Traceback (most recent call last)
<ipython-input-6-fe8fafeed45d> in <module>
24 from omegaconf import OmegaConf
25 from PIL import Image
---> 26 from taming.models import cond_transformer, vqgan
27 import torch
28 from torch import nn, optim
1 frames
/content/taming-transformers/main.py in <module>
10 from pytorch_lightning.trainer import Trainer
11 from pytorch_lightning.callbacks import ModelCheckpoint, Callback, LearningRateMonitor
---> 12 from pytorch_lightning.utilities.distributed import rank_zero_only
13
14 from taming.data.utils import custom_collate
ImportError: cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed' (/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/distributed.py)
I don't know how to solde this problem. I don't know how to manually install Pytorch as it said "NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below."
Thank you in advance if you have the solution.
Inès
I triad !pip install but I may not really know where to put this cell/line of code
pytorch_lightning has recently released a new version which will throw this error (version 1.8.0.post1 released on November 2nd 2022).
https://pypi.org/project/pytorch-lightning/#history
Just install an older version of pytorch_lightning and it will work.
In my system, I ran "pip install pytorch-lightning==1.6.5", higher versions may work as well, you can check them out by clicking on the link provided above and then clicking on release history.
Finally, after long research, I found the solution for it, try to run it, you will face an issue with CLIP module, once you resolve python issue as well, so for that follow the second code.
conda install pytorch-lightning -c conda-forge
Once you clone it, try to follow below command
Step:1 cd CLIP
Step2: python setup.py
after that,
type: cd..
Once you do that, you will be redirected to previous directory named "VQGAN-CLIP"
and finally, run the following command:
python generate.py -p "A painting of an apple in a fruit bowl"
Once it is done, then run your generate python file, It will work fine.
use #vishisht-rao solution to downgrade the package version of pytorch-lightning to 1.7.7; this step by itself did not solve the problem for me.
pip install pytorch-lightning==1.6.5
run pip list|grep lightning to find the installed version of lightning-utilities. Mine was lightning-utilities==0.4.2
Downgrade the package version of lightning-utilities to 0.4.0
pip install lightning-utilities==0.4.0
Downgrading the package versions of both pytorch-lightning and lightning-utilities solved the problem for me.

Python Cannot Find Module Located in Sub-Directory when Importing QAxContainer from PyQt5

Python appears to be unable to locate the module QAxContainer in PyQt5. The package was installed using Conda and is present in a sub-directory of PyQt5 but cannot be located. Additional testing with pip resulted in the same error.
Ubuntu 20.04
Python 3.8.5
conda list
pyqt5 5.15.2 pypi_0 pypi
from PyQt5 import QAxContainer
ImportError: cannot import name 'QAxContainer' from 'PyQt5' (/home/brian/anaconda3/lib/python3.8/site-packages/PyQt5/init.py)
However, qaxcontainer.py is present in /home/brian/anaconda3/lib/python3.8/site-packages/PyQt5/uic/widget-plugins
There should be QAxContainer.pyd and QAxContainer.pyi at /home/brian/anaconda3/lib/python3.8/site-packages/PyQt5/. If you dont have them maybe there's a problem with the package, try reinstalling PyQt5.
According to antonio2924, QAxContainer.pyd and QAxContainer.pyi should be located at /home/brian/anaconda3/lib/python3.8/site-packages/PyQt5/. The .pyd file extension is specific to Windows. Furthermore:
The QAxContainer module is a Windows-only extension for accessing
ActiveX controls and COM objects. See, https://doc.qt.io/qt-5/qaxcontainer-module.html
I am running Ubuntu 20.04, which explains why QAxContainer is not being installed.

[Google Colaboratory]: Why can't I use and import a module/package after installing it from Github?

I installed the ismrmrd-python-tools succesfully after running the following command on Colab:
!pip install git+https://github.com/ismrmrd/ismrmrd-python-tools.git
Successfully built ismrmrd-python-tools
But when I want to import the module, I get the next message error:
ModuleNotFoundError: No module named 'ismrmrd'
I tried with other module names like 'ismrmrd-python-tools', 'ismrmrdtools', etc. as well.
Does someone know anything about what could possibly be happening here?
I try it and it works without any problems.
!pip install git+https://github.com/ismrmrd/ismrmrd-python-tools.git
import ismrmrdtools

Import Error on conda even directory exists

Environment info: Anaconda, windows7x64, py3.5
I setup a virtual env named as menpo to run menpoproject. For a long time I was using load_dlib_frontal_face_detector smoothly. After tinkering with a pip-install dlib command accidentally on virtualenv (I mean via Anaconda Prompt menpo) , I couldn't get my code working due to an "ImportError" ImportError: cannot import name' load_dlib_frontal_face_detector'. Code is like below:
import cv2
import menpo.io as mio
import menpodetect
Throws error at line 3.
There is this guy seems to had a similar issue.
https://github.com/menpo/menpodetect/issues/15
I did all the
conda remove dlib -y
pip uninstall dlib
conda install -c conda-forge dlib
stuff but still got the same error. Besides that;
Uninstalled Anaconda completely
Removed all Python folders wherever I found.
Installed Anaconda and setup a new menpo virtual env and still no luck. It seems like this dlib installation I made causing some issues. BTW, conda list produces dlib 18.18 py35_2 menpo and there is no pip line as mentioned in the link given above.
Wrong alarm. Seems that I've named my py file as menpodetect which I shouldn't do. Problem solved.

Install BeautifulSoup, mrjob, pattern, and seaborn on python 2.7 on Jupyter

I am learning how to use the new Jupyter. I want to install packages:BeautifulSoup, mrjob, pattern, and seaborn on python 2.7. I first tried to do so by running pip install BeautifulSoup mrjob pattern seaborn That all returns: SyntaxError: invalid syntax
I also tried from bs4 import BeautifulSoup, it did work for Beautifulsoup. But I still don't know how to install other packages.
Wondering anyone know why there was syntax error for using pip install? Is that because I haven't installed pip on python 2.7?
I was also able to install these packages from iphython notebook window by running
import pip
def install(package):
pip.main(['install', package])
install('BeautifulSoup4')
Have you tried installing one package at a time. This helps you find which installation command not working.
You can find Julia packages here.
The problem was I was running pip from inside Jupyter. However, Jupyter is a command line program. Thanks to Mwaskom, the solution is run it from a terminal using:
pip install BeautifulSoup mrjob pattern seaborn
You could try:
!pip install BeautifulSoup mrjob pattern seaborn