How to install pycocotools on Windows 10 - windows-10

I am trying to install pycocotools on Windows 10. I used this command:
pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI
You can see the error output in the following picture:
Any ideas on how to fix that?

Windows building of some COCO tools gave me a bit of a headache too, I finnaly translated decode mask function for the Windows version of my code.
https://github.com/armengot/COCO_decode_mask/tree/main/python
In Linux any problems.

Related

Downloading and installing PyBluez for a 64-bit Windows 10 PC?

I'm trying to use bluetooth with python, and I came across a module - pybluez. Right then, I tried installing it by running pip install pybluez. The package was located and downloaded, but it raised an error when running python setup.py egg_info.
I then tried to download pyBluez from this link https://pypi.python.org/pypi/PyBluez
But, it said that the Python version installed on my PC is not 2.7 ( I have 2.7.10; do I need 2.7.0 for this?) Also, this download link is for a 32-bit system, and that might be the reason it does not run on mine.
So I ask:
1. How do I fix this error?
Error in the output when I try to install pybluez using pip:
2.Does download using https://pypi.python.org/pypi/PyBluez need python 2.7.0, and a 32-bit system? If so, can someone suggest a better way for a 64-bit system?
3.Any other bluetooth module that could work as a substitute?
I have successfully built pybluez for win10x64 with python3.6
Download and install windows 10 build tools: https://www.visualstudio.com/pl/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15
Run 'Developer Command Prompt for VS' as administrator
Clone pybluez repo https://github.com/karulis/pybluez
cd to directory with repo
run python setup.py install
Happy bluetoothing
This is an "expanded solution" which supplements the other answers posted.
Bluetooth is readily supported on Linux in basically any context. Python 3 built-in socket objects work over bluetooth even. But for Windows, there are hoops to jump through. The standard solution for this is to use PyBluez. If you're really lucky, you might be able to install with just pip install PyBluez-win10. If that fails, however, the way to go is an installation via a pre-compiled "wheel".
A given wheel only works for your specific context, however, i.e. exact Python version. So, for the sake of future proofing, if you are going to need PyBluez, you should know how create a wheel from the source for yourself. It's a long, annoying process if you don't have the all the software required already and are not familiar with some parts of the process e.g. using Anaconda. So, if you are working in a team, I suggest having one person burn their time on this and then share the wheel with everyone (who are hopefully on the same version of Python!).
The following is a paraphrased version of what is posted here: https://github.com/pybluez/pybluez/issues/180 which includes the actual developer's comments and methodology.
Download and run the "Visual Studio Build Tools" installer:
For an official list of exact compilers and links to match against target Python versions, refer to: https://wiki.python.org/moin/WindowsCompilers
Here's the 2019 Build Tools link, which works with Py3.7:
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019
During the install you MUST select BOTH "Visual C++ build tools" AND "Universal Windows Platform build tools". Leave the default options alone within those (e.g. including the Windows 10 SDK).
Note: this requires 15GB of disk space, and some patience!
Install "Miniconda":
https://docs.conda.io/en/latest/miniconda.html
Select the one which matches the bit set (32 vs 64) of the destination Python version
you wish to install PyBluez into.
Clone the PyBluez source repo to a temp location (e.g. your desktop). Then, launch the terminal and change into that directory:
git clone https://github.com/pybluez/pybluez
cd pybluez
If you did NOT put conda on the system path (as the installer recommends NOT doing so), you can add it for this local CMD session per this example command:
set CONDA_DIR=%USERPROFILE%\Miniconda3
set PATH=%CONDA_DIR%\condabin;%PATH%
Create a dedicated environment to build pybluez with the desired Python version. Then, launch that. The example below uses Python 3.7 but the same steps will also work for other versions (including Py 2.x etc)
conda create -y -n pybluez python==3.7
activate pybluez
Build a wheel file. Then, leave the dedicated environment.
python setup.py install
python setup.py bdist_wheel
deactivate
Copy the wheel to your desktop. From there, you can do with it as you wish. Then, delete the pybluez conda environment and the source repo, (as you no longer need either of them).
copy .\dist\*.whl "%USERPROFILE%\Desktop"
cd..
rd /s /q "%CONDA_DIR%\envs\pybluez"
rd /s /q pybluez
Finally, you can install the wheel to a target Python instance and/or store/share it:
The name of these files and the path will vary, so define those first for your use case
set PYBLUEZ_WHEEL=%USERPROFILE%\Desktop\PyBluez-0.22-cp37-cp37m-win_amd64.whl
set PYTHON_PATH=python
Install the wheel:
%PYTHON_PATH% -m pip install "%PYBLUEZ_WHEEL%"
Confirm installation:
%PYTHON_PATH% -c "import bluetooth; print(bluetooth.__version__)"
I downloaded a Python 3.6 wheel from here (wheels for python 2.7, 3.5, 3.6, 3.7 available too).
I installed it in my virtual environment via
pip install PyBluez-0.22-cp36-cp36m-win_amd64.whl
One command solution.
pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez

How to install pytorch on windows subsystem for linux

my windows10 has subsystem for linux of 14.04. I tried to install pytorch on the preinstalled python2 but couldn't work.The error is: torch-0.2.0.post1-cp27-cp27m-manylinux1_x86_64.whl is not a supported wheel on this platform. I tried to install python3.6 then install pytorch with it, but still couldn't work.The error is missing module 'apt_pkg'. Anyone has idea on this?
According to this it should be working now via anaconda's package manager conda.
If you look in the whl filename, there are two bits to pay attention to. Firstly, the cp27 and secondly the x86_64 bit.
That first one tells you that you need python 2.7 which is the default for the WSL, so that's fine.
The second one tells you that the whl has been compiled for a 32 bit computer. If you have a 64 bit computer, it will fail.

How to use pip with Visual Studio Code

I have python 3.6 installed, I have a python extension installed on Visual Studio code but I still can't use pip on Visual Studio code. It says it is not a recognised command. Any help please?
Update: I tried installing pip manually but a file in python2.7 keeps stopping. What's bothersome is that I uninstalled python 2.7 ages ago and I've currently removed every folder with it but python-V still says I have python2.7.6 installed.
I'm on windows 10
I found some solution on this website:
https://pip.pypa.io/en/stable/installing/
If you use Visual Studio Code, you can type the following command:
C:\> py -m pip
If everything is alright, you should see the list of commands, which you can use. They are listed in your terminal, as per below.
I also would advise you to check/select the version of Python you are using:
VSCode: There is no Pip installer available in the selected environment
I am pretty sure your problems of VSCode not finding the correct version of Python will be resolved if you add your ( Python 3.6 installation ) location to the system path.

Node.js installation error

I tried to install node.js on a Windows 8 machine, but I got the following error:
The cabinet file 'media1.cab' required for this installation
is corrupt and cannot be used. This could indicate a network error, an
error reading from the the CD-ROM, or a problem with this package.
I downloaded the installation file from the node.js website at http://nodejs.org/download/.
How I can solve this problem.
My system specifications are OS : Windows8 32bit, RAM : 4GB, CPU :
Intel Pentium P6200, 2.13Gz, Dual Core
I was experiencing the same error message trying to install on Windows 7.
I was able to fix this issue and successfully install by:
changing the directory for installation.
Instead of installing within my "Program Files (X86)" folder, I installed into my "Program Files" folder
My suggestion is to try installing to a different directory as this solved the problem for me.
For anyone stumbling here, my problem (on win 7) was I accidentally downloaded the 32-bit version by mistake. Getting the 64-bit version was the solution.
Actually above none of answers ara not worked for me. I'm using windows 8.1 x64 . So i'm trying install nodejs.msi. Actually i can not install it. So i have used Chocolatey package manager. This is the command that i used for install nodejs. choco install nodejs.install Thats all it worked :)

can't run stipdet in open cv

I 'm trying to run some precompiled code (source code is not available) on Ubuntu, which requires openCV to be installed. I installed the latest version of openCV (from the SVN) yesterday, and installed it according to the debian install guide on the openCV website (cmake -> make -> sudo make install) and everything seemed to go fine.
I tried to run stipdet program but this gives me following error.
bash: ./stipdet: cannot execute binary file
Please can anyone help me with this error?
What does:
file $(which stipdet)
...say? I'm guessing it was built for a CPU you don't have.
You need to run chmod 755 ./stipdet to make stipdet executable.

Resources