Can't import own python module in Postgresql plpython function - python

I created my own python module and packaged it with distutils. Now I installed it on a new system (python setup.py install) and I'm trying to call it from a plpython3u function, but I get an error saying the module does not exist.
It was working on a previous Ubuntu instalation, and I'm not sure what I did wrong when setting up my new system.
I'm trying this on a Ubuntu 15.10 pc with postgresql 9.5, everything freshly installed. I'm also trying this setup in a docker image built with the same componentes (ubuntu 15.10 and pg 9.5). I get the same error in both setups.
Could you please hint me about why this is failing? I wrote down my installation instructions for both systems (native and docker), so I can provide them if that helps.
Thanks

Sorry guys I think I found the problem. I'm using plpython3 in my stored procedure, but intalled my custom module using python 2. I just did sudo python3 setup.py install and now it's working on the native Ubuntu. I'll now try modifying my docker image and see if it works there too.
Thanks

Related

ImportError: cannot import name 'cygrpc' from 'grpc._cython'

I'm attempting to use the Dapr python API in an Ubuntu 20.04 container. I'm building and running the container image on a Ubuntu 20.04 VM in Azure.
Attempting to import Dapr results in this error:
ImportError: cannot import name 'cygrpc' from 'grpc._cython'
Which from my research is unrelated to Dapr and pops up a lot when trying to use gRPC
I've Googled extensively and tried these fixes:
People are using 32bit python and need to use 64bit
Can confirm that my Python interpreter is 64bit:
Attempting to use on ARM architecture
Can confirm I'm using x86_64:
Also tried other suggestions such as using grpcio==1.27.2
And a lot of other answers relate to AWS which doesn't apply.
I am using an "interesting" Python runtime that's built into the Houdini 3D software package but haven't ever run into compatibility issues before.
This is my requirements.txt:
dapr == 1.5.0; python_version >= '3.7'
And this is my pip command:
pip3 install --no-input -r /usr/local/hourequirements.txt -t /opt/houdini/houdini/python3.7libs
Are there ways to further debug this issue?
Is there a guide somewhere to build gRPC on linux?

No module named _sqlite3 for scrapyd

I'm new bie to Python who is stucked in the need of recompilation of Python.
I have server with Centos where I have installed Python3.6 and then scrapyd. Everything installed successfully, however when I try to run scrapyd command, it shows me below error:
After search a while, I got to know that sqlite3 should be installed even before Python3.6, however I have installed sqlite3 now but now found that I need recompile the Python.
So, Above is the situation, now I have a question that, is that the case where I needed to install sqlite3 and recompile the Python? If yes then how I can recompile Python? If no then how can I get rid of this issue and can start the scrapyd?
Help is really appreciable.
I believe, you'll need to re-install the python version as per this as actually the sqlite3 is the extension which should be install before Python gets installed.
Please check this -
How to import sqlite3 in my python3.4 successfully?

PYTHONBREW: numpy installed but package not found

I have some pyhton-scripts which are working perfectly on my local computer, but as you would guess, not so good on the server!
I wanted to use "pythonbrew" since at the server I have only Python 2.7.6 installed, but I need hdf5-package running ... OK
I installed pythonbrew (according to https://pypi.python.org/pypi/pythonbrew/) and switched to version 2.7.10 (as I use on my local computer).
Now I got some "numpy-issues". So I installed numpy with pip successfully (according to How do you install numpy when you're not a superuser? and https://gist.github.com/audy/4012573), however, when I am running the programme:
pythonbrew py startup.py
I got the error message saying numpy was not found ...
I really have no clue what I am missing here? I appreciate any help!
I found out myself how to run a python script with pythonbrew properly!
According installation guide for pythonbrew (see: https://pypi.python.org/pypi/pythonbrew/), the following line should be used to run a script:
pythonbrew py myprogramm.py
However, I can run my script by using python instead of pythonbrew py:
python myprogramm.py
I cannot give an explanation for that, sorry. But maybe other people can. It is just working very well like this and I can use python and all packages normally!
Further instructions of how to use pythonbrew, installing or switching between different version etc., see the link to the installation guide I posted above!
More details about pythonbrew and usage (from my perspective of view):
The installation guide I mentioned explains step by step how to install pythonbrew in your home directory (e.g. on a server) and helps to set up python on a system where you are not superuser (e.g. a server where you are allowed to run scripts but not to execute any further installations!).
I had the problem that I needed a more up to date python-version and the server where the data is located is equipped with an older version. The other half of the story is that I also needed some packages (e.g. h5py or cosmolopy) which are also not installed at the server.
For me the easiest and perfectly working solution to that problems was to use pythonbrew and install it at my home directory on the server!

trouble with importing python modules

I am trying to import Python packages that I had previously installed but I keep getting this error when trying to import it
"ImportError: No module named gdal"
In the images attached (in the link :P) you can see that the package python-gdal and python-numpy are installed. I am also attaching the python output.
P.S = I am using Ubuntu and running python from the terminal.
You have possibly installed a non-Ubuntu version of Python - Anaconda - yet these packages are installed into the system Python. You should probably remove Anaconda, and/or run the system Python explicitly as /usr/bin/python.

Robot Framework can't find Python

I'm trying to install Robot Framework, but it keeps giving me an error message during setup that "No Python installation found in the registry." I've tried running the installer as administrator, I've made sure that Python is installed (I've tried both 2.7.2 and 2.7.9), and both C:\Python27 and C:\Python27\Scripts are added to the PATH (with and without slashes on the end, if that matters).
I have no idea why it can't find Python. What do I need to do?
Try to add the following path in environment variable also:
"C:\Python27\Lib\site-packages"
Since this path consists all the third party modules installed on your PC and also verify if robot-framework library is present in this folder.
I faced the same issue.
Install a different bit version of ROBOT framework. In my case, I was first trying to install 64bit version but it said "No Python installation found in the registry."
Then I tried to install the 32bit version of ROBOT framework and it worked.
So there is nothing wrong with your Python version.

Categories

Resources