How can I install the dbconnect module in Python?

1.1k Views Asked by At

I am VERY new to python (as in I just started yesterday, but I have used R in the past) and I'm trying to install this module (https://github.com/CellProfiler/CellProfiler-Analyst/find/master) but in order for me to do that I have to install a number of other modules first that this module cites like properties, verlib and pickle5. I get to one called dbconnect and do the same command as usual

pip install dbconnect

And I get the same message that dbconnect has been installed

Collecting dbconnect

Using cached dbConnect-2.1-py2.py3-none-any.whl (12 kB)

Requirement already satisfied: setuptools in ./opt/anaconda3/envs/threeseven/lib/python3.7/site-packages (from dbconnect) (52.0.0.post20210125)

Installing collected packages: dbconnect

Successfully installed dbconnect-2.1

But then when I try to use py2app to install the github module to see which other modules I need to install I get this error message despite having installed dbconnect

ModuleNotFoundError: No module named 'dbconnect'

I've tried uninstalling and reinstalling dbconnect in several virtual environments using Anaconda but I still get the same error. I could try installing different versions of dbconnect but wanted to see what you thought before trying. Thanks everyone!

1

There are 1 best solutions below

2
On

pip install dbconnect installs wrong dbconnect. Right dbconnect is inside package cpa and it should be installed along with the very CellProfiler-Analyst. The problem is that cpa/__init__.py imports it using relative import: import dbconnect. This is Python2-style import, it doesn't work in Python 3.

Let's us look into the docs: https://github.com/CellProfiler/CellProfiler-Analyst/wiki#source-code. Python 3 is not mentioned, only Python 2.7.

The bottom line: the code is only for Python 2.7.