Cannot install OpenCV in PyCharm GUI with Anaconda interpreter - python

I wanna install OpenCV module in GUI if it is possible.
But as following pictures, the search result doesn't show opencv-python and opencv-contrib-python modules.
Why this problem happens?

There is just no such a package in repositories used by conda package manager.
Running conda install opencv-python from the system terminal will fail for the same reason.
You can install it with pip though.
Click the following button to use pip instead of conda package manager and try again:

Related

OpenCV don't show methods in Pycharm

I'm trying to install the OpenCV library, to be able to manipulate images, to install it, I'm using the command in prompt:
pip install opencv-python
But it doesn't work, in pycharm the methods I need do not appear, such as: "cv2.imread()" or "cv2.imshow()":
Pycharm IDE
Notes:
I'm using the python version 3.11.1
i'm using the OpenCv version 4.7.0.68
I'm coding in Windows plataform
I also tried using the command:
pip install opencv-contrib-python
I thought that would solve the situation, but it stayed the same
This will fix issue but roll you back to the previous version
pip install opencv-python==4.5.5.62
do this to return back to the latest version
pip install -U opencv-python

ModuleNotFoundError: No module named 'cv2' (only in vscode with venv)

When I try to install opencv-python I get the following error:
ModuleNotFoundError: No module named 'cv2'
I tried to install cv2 via these commands:
pip install opencv-python
pip install opencv-contrib-python
pip install opencv-python opencv-python-headless
python3 -m pip install opencv-python
pip3 install opencv-python --upgrade
However, the problem remains.
I have noticed that this problem occurs only in the virtual environment (venv) of VScode.
In fact, if I launch this code from the terminal it does not give me any error and it returns me the version of cv2
import cv2
print (cv2.__version__)
Reply -> 4.6.0
I use Python 3.9
EDIT:
This is a screenshot of the problem
The problem do not appear if I create a new venv
Use Ctrl+Shift+P to open the command palette search and select Python:Select Interpreter, then select the correct interpreter, this will solve your problem.
Tip: Every time you choose a new interpreter, please create a new terminal to activate the environment.
As far as your question is concerned, you can follow these steps:
Select the interpreter in the virtual environment according to the above method
Create a new terminal
Use pip install opencv-python to install the package
Also you can use pip show opencv-python to see where the package is installed.
What solved it for me was adding the following to the .vscode/settings.json config file
// Add venv to python path
"python.analysis.extraPaths": [
"${workspaceFolder}/venv/lib/python3.8/site-packages"
]
change venv to the name of your virtual env folder.

Installing fix_yahoo_finance without pip in Anaconda

I am learning Python and use Anaconda navigator 1.8.7 and Spyder 3.3.0 (Python 3.6.6 32 bits, QT 5.9.4, PyQt5 5.9.2 on Windows). I would like to install a package called 'fix_yahoo_finance' without using pip since I have read that pip creates problems for Anaconda users.
I know that this is the line of code used when using pip:
pip install fix_yahoo_finance --upgrade --no-cache-dir
When I tried using
conda install fix_yahoo_finance
and I get a 'Solving environment: failed'
How do I get this package without using pip? Is there an alternative way that I could run this package in Anaconda like placing it in the pkgs folder?? I am absolutely confused and would really appreciate your help on this.
Thanks a lot in advance.
You can actually install it from other way around as well, clone this repo into your local system.
git clone https://github.com/ranaroussi/fix-yahoo-finance.git
Then go to the directory fix-yahoo-finance or any dir that you have cloned the repo. Then run sudo python3 setup.py install
This way too you can install the package without using pip, but make sure your python is pointing to the Anaconda's python, otherwise the only way to install it would be to copy the package folder from the site-pacakges and paste inside the Conda's package folder. Also you can look around your conda install error, https://github.com/conda/conda/issues/6390

Pycharm install package error

I'm trying to install the wxPython package using Pycharm's Project Interpreter on my mac. I have been able to install other packages in the past, but with this package I get an error:
Any ideas? I've checked, and I have both read and write permissions to both the ./pip and ./pip/http directories, and pip is up to date.
Try using homebrew instead.
Once brew is installed, just type 'brew install wxpython' in your terminal to install wxPython.

Install Numpy in pydev(eclipse)

I am trying to install a package called 'numpy'.
i have python setup in eclipse luna with the help of pydev.
how do i install numpy in pydev.
tried putting numpy in site-packages folder. doesnt seem to work
In Eclipse, Goto Windows->Preferences
Select PyDev->Interpreters->Python Interpreters
Then click on Manage with pip button, then you will see a new window like below, you just need to type your package and click Run/Press enter.
After this, Click Apply and OK, then Right click on Project then click on PyDev->Remove error markers.
Hope it works.
do you have pip installed with your python?
How to install pip
Then if you have your path variable set you can simply type "pip install numpy" into command line.
download the required version of numpy from here http://sourceforge.net/projects/numpy/files/NumPy/1.9.2/
and the install directly ,it will run on eclipse automatically
If it does not solve your purpose use Pip:
pip install numpy
Correct way is to create a virtualenv virtualenv ~/venvs/eclipse, install numpy (source ~/venv/eclipse/bin/activate;pip install numpy), then add the virtualenv to eclipse (see https://www.rose-hulman.edu/class/csse/resources/Eclipse/eclipse-python-configuration.htm)
Pandas can be installed after install python in to your pc.
to install pandas go to command prompt and type "pip install pandas" this command collecting packages related to pandas. After if it asking to upgrade pip or if pip is not recognized by the command prompt use this command:
python -m pip install --upgrade pip.

Categories

Resources