0

Trying to work with image recognition, I installed Python with OpenCV, following this tutorial. Later on, I decided to give PyDIP a try, running the commands given on this answer.

The first command just don't work:

>>> import PyDIP as dip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyDIP'

I tried to install it using:

(cv) user@pc:~$ python -m pip install PyDIP
Requirement already satisfied: PyDIP in ./.virtualenvs/cv/lib/python3.7/site-packages (0.1.8)

The location of python and pip also seem correct:

(cv) user@pc:~$ which -a python
/home/user/.virtualenvs/cv/bin/python
/usr/bin/python
/bin/python

(cv) user@pc:~$ which -a pip
/home/user/.virtualenvs/cv/bin/pip
/usr/local/bin/pip

I'm using a Virtual Environment (exactly as in the first link), thus the (cv) on the prompt. There are different Python versions installed, but as I've read, the first one listed with which should be used. If the python and pip executables are on the same folder as the PyDIP package, what's going on?

I'm using Debian 10, python 3.7.3 and pip 20.0.2.

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
Rodrigo
  • 4,706
  • 6
  • 51
  • 94
  • The package is installed in python3.7 dir: `./.virtualenvs/cv/lib/python3.7`, while python points to `python`. try running the script with `python3.7 xxx.py` – Dawid Gacek Jan 28 '20 at 15:56
  • @DawidGacek Actually `.../bin/python` is a symbolic link to `python3`, which is a 3.7 executable. And I'm not running a script, but a single command inside the Python interface. – Rodrigo Jan 28 '20 at 16:00

2 Answers2

0

You are trying to install the PyDIP module by installing it with pip, but the Python Package Index says the pydip module on there is an

Adjudication logic engine for Diplomacy board game

To install it you have to build it from source.

Check here for help.

Wouterr
  • 516
  • 7
  • 16
  • There is no need to build from sources: `pip install pydip` will do it. And BTW PyPI and `pip` don't distinguish PyDIP from pydip; Python does. – phd Jan 28 '20 at 19:12
  • @phd: Yes, there is a need to install from sources. The PyDIP that OP is asking about is not the pydip that is in the package repository. PyDIP is the Python bindings for DIPlib, and they're not available on the package repository, they need to be built from sources. There's a binary distribution for Windows, not for Linux. – Cris Luengo Feb 04 '20 at 20:33
  • @CrisLuengo In my answer I mention both. – phd Feb 04 '20 at 20:51
0

The project has top-level package pydip (not PyDIP). So import it:

import pydip as dip

AFAIU PyDIP is a different package.

phd
  • 82,685
  • 13
  • 120
  • 165