How do I install OpenCV without it upgrading my python version on Mac? - python-3.x

I tried to install opencv for Python 3.6.5 on Mac OS. I tried brew install opencv, but it updates my python version to 3.7.
I tried brew pin python and then tried the installation but it just fails as it can't update the dependency.
Error: You must `brew unpin python` as installing opencv requires the latest version of pinned dependencies
I don't want to use pip install opencv-python as I read somewhere that it is not official.
Can someone help me out?

Related

import distutils.command.bdist_wininst as orig

Everything went well while I was trying to create a ros 2 package in Ubuntu 22.04 by following the ros2 documentation, however when I got to the colcon build step, it failed for python packages even though it works for cMake packages.
colcon build --packages-select mypkgpython
...
import distutils.command.bdist_wininst as orig
ModuleNotFoundError: No module named 'distutils.command.bdist_wininst'
knowing that my python version is:
python3 --version
Python 3.10.6
i have tried:
sudo apt-get install python3-distutils:
python3-distutils is already the newest version (3.10.6-1~22.04).
sudo apt-get install python3-apt:
python3-apt is already the newest version (2.4.0).
sudo apt install python3-colcon-common-extensions
python3-colcon-common-extensions is already the newest version(0.3.0-1)
how can i solve this problem?
i expected when i build my python package using
colcon build package
it will be successfully build, so i could work with
The bdist_wininst command was deprecated in Python 3.8 and you are using python 3.10
Its no more found in python3-distutils package .
use
bdist_wheel (wheel packages) instead
or
if you want to run your code as it is downgrade your python to < 3.8
The bdist_wininst format was deprecated in Python 3.8, and the documentation for this format has been removed in Python 3.9. The recommended way to distribute Python packages now is the Wheel format.
you can overcome this error by JUST updating the setuptools
pip install --upgrade setuptools
Note that: Setuptools version 58.2.0 is the last version that works with ROS 2 python packages without any warnings because it is the last version that supports the old installation method, "python setup.py install." This method has been deprecated and replaced by newer, standards-based tools, such as pip and ament.
pip install setuptools==58.2.0

how to install python 3.9.6 using homebrew on Mac m1

Im new to programming and stuff and was looking to install python 3.9.6 using home-brew. To do that would I just have to type in brew install python#3.9 into the terminal, or is there some other way? Thanks!
You can't ensure a specific version 3.9.6 with brew package python#3.9. Homebrew is a package manage designed to get latest pacakge. python#3.9 will be kept updating to the latest patch version 3.9.x.
If you REALLY to stick with specific python version, choose conda (miniconda is preferred) or pyenv.

Could not find a version that satisfies the requirement MetaTrader5

I am trying to install a python package MetaTrader5 using the command
python3 -m pip install MetaTrader5
and I have even tried
pip install MetaTrader5
But it throws the following error
ERROR: Could not find a version that satisfies the requirement MetaTrader5 (from versions: none)
ERROR: No matching distribution found for MetaTrader5
I am using
Ubuntu 16.04.6
Python 3.6.10
can someone help with this?
I have a mac. On it I have conda installed on MacOS. In addition I have a virtual machine running windows and I have also installed conda on Windows. I could install MetaTrader5 package using pip on the virtual machine but not on MacOS.
According to this Youtube video, MetaTrader5 currently doesn't support Ubuntu. It's only available on Windows.
If you look at Pypy and view the wheel files, you will see that all the builds are for Windows. pip is refusing to install because it can't find a Mac or Linux version.
https://pypi.org/project/MetaTrader5/5.0.37/#files
Download python version 3.10.0 then try installing metatrader5.
here the link: https://www.python.org/downloads/release/python-3100/
Metatrader 5 for Python, only work in exact versions:
Install one of version below to MT5 works.
Python Versions for Metatrader5

How to update OpenCV 3.4.2 to OpenCV 4 or latest stable version?

I have installed OpenCV 3.4.2 successfully by following the tutorial given here:
https://www.pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu/
Now, I would like to update to openCV 4 or the latest stable version.
Do I need to uninstall 3.4.2 first?
If so, how should I uninstall it.
I am afraid to creating another virtual environment and installing version 4 or master package from github by following the same steps might create conflicts. Please advice.
Working on Ubuntu 16.04 LTS, python 3.5
For Python interface, I guess you can try something like pip install opencv-python==4.0.0.21. Note, you might need to run pip3 install opencv-python==4.0.0.21 depending upon your pip version.

opencv_python-3.4.2+contrib-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform

while trying to install the wheel file I'm getting the not a supported wheel on this platform and also updated pip
opencv_python-3.4.2+contrib-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform
try this
pip install opencv-contrib-python
This will install it via pip. And it is way easier to do.
I am running python 3.5 for this inside anaconda. Install with no issues.
Please note you can only have one version installed at a time on each environment.

Resources