1

I'm trying to develop a Python script, and I seem to be running into a conflict between two of the libraries that I want to include.

The first dependency that I have is pymoos (https://github.com/msis/python-moos), which is necessary to connect to my communication architecture. I've built the code and manually installed the resultant pymoos.so in the following places:

  • /usr/lib/python3.6/site-packages/pymoos.so
  • /usr/lib64/python2.7/lib-dynload/pymoos.so
  • /usr/lib64/python3.6/lib-dynload/pymoos.so
  • /usr/local/lib/python3.7/lib-dynload/pymoos.so

However, only python2.7 will allow me to 'import pymoos' from the interpreter. Attempting from either of the Python3 versions produces this:

Python 3.6.8 (default, Jun 11 2019, 15:15:01) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pymoos Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: dynamic module does not define module export function (PyInit_pymoos) 

The second dependency is pydantic, which I have only managed to install using pip3, apparently meaning that it's only available from either of the versions of Python3 that I have installed. Attempting to import from Python2 gives the following:

Python 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pydantic Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named pydantic 

Since I know where the pymoos.so library is, I think that my easiest path forward is to put that in the right place so it works with python3, but I can't seem to find the right place!

6
  • Moos says it supports python 3 so try to install it using pip3. Pydantic definitely only works with python >=3.6. Commented Oct 10, 2019 at 21:27
  • That's an interesting idea - I know that pymoos isn't on the pip repositories, so I'm looking into how I can use pip3 to install from the source that I downloaded off github, which generates a shared object library using cmake. Do you have any tips on how to do that? I've been pretty heavily invested in C++ for the past few years so I'm a little rusty on Python configuration and package installation. Thanks again! Commented Oct 11, 2019 at 13:07
  • it should be as simple as pip install path/to/pymoos/code, but you might be better off using a more widely used database library like asyncpg or psycopg. Commented Oct 15, 2019 at 12:42
  • Thank you for the help - you sent me down exactly the right rabbit trail. I wasn't able to just simply install with pip quite that easily, but I was able to use the included setup.py to generate a wheel file and then install that with pip. The two relevant commands were: sudo python3.7 setup.py bdist_wheel and sudo pip3 install dist/pymoos-0.0.1-cp37-cp37m-linux_x86_64.whl It worked on one computer just fine, I'm having a new problem with the other where it tells me that this and other .whl files "is not a supported wheel on this platform." So I'm tracking that down. Commented Oct 15, 2019 at 13:29
  • @SColvin: I'd like to give you credit for the solution. Is there a way to do that with a comment, or could you please post as a solution so that I can approve? Thanks! Commented Oct 15, 2019 at 13:34

1 Answer 1

1

as per my comment:

it should be as simple as pip install path/to/pymoos/code, but you might be better off using a more widely used database library like asyncpg or psycopg.

Regarding having to use sudo, you might consider using virtualenv or similar to setup a dedicated python environment for your application.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.