0

This is the error when trying to run a Python loader function through mclient.

TypeException:user.main[4]:'pyapi3.eval' undefined: Embedded Python 3 has  
not been installed. Please install it first, then start server with --set embedded_py=3

When typing monetdb get all I can see that embedpy3 is set to yes because I have already done the -- set embedded_py3=yes.

I have installed monetdb through homebrew on macos.

hous
  • 92
  • 1
  • 11

2 Answers2

1

The homebrew version of MonetDB was built with the option -DPY3INTEGRATION=OFF, in other words, there is no Python integration in the homebrew version.

If you want, you can try to compile it yourself using the homebrew formula after changing that OFF into ON.

  • Thank you Sjoerd for your quick response but I can not figure out where this option comes together. Could it be something like brew update monetdb -dpy3integration=on ? Because that does not work. – Andreas Mar 02 '22 at 10:52
  • You need to edit the formula, so the actual file monetdb.rb inside the homebrew directory. But you're on your own here, since we haven't done this ourselves. Embedded Python does work on the Mac, it's just the homebrew version where we haven't tried this. – Sjoerd Mullender Mar 03 '22 at 11:55
1

As Sjoerd said, the default homebrew build has the CMake option -DPY3INTEGRATION=OFF, which turns off embedded python3 functions. To install it with this option turned on, you'll need to edit the brew formula and compile it from source (through brew).

First, uninstall the current package:

brew uninstall monetdb
brew cleanup -s monetdb

Then, edit the brew formula:

brew edit monetdb

Find "-DPY3INTEGRATION=OFF" and change it to "-DPY3INTEGRATION=ON"

Finally, install it from source, using the new formula:

brew install -s monetdb

Make sure you have python3 and numpy installed, otherwise it won't work.

NOTE: This still might fail if you have multiple python installations and the one used in the build process does not have numpy installed. In that case, reach out and we'll help you.

  • Hello Bernardo, thank you for your quick response. Your suggestions were all very helpful but I still face the same issues. I can confirm that I have Python 3.9.1 installed and numpy (Requirement already satisfied: numpy in /usr/local/lib/python3.9/site-packages (1.22.2)). But after trying to use a python udf I get the same error from inside mclient: "TypeException:user.main[4]:'pyapi3.eval' undefined: Embedded Python 3 has not been installed. Please install it first, then start server with --set embedded_py=3", even though I've already set embedpy3=yes. – Andreas Mar 04 '22 at 13:48
  • Hi Andreas, it does seems like the build process is using a different python installation, which does not have numpy installed. Do you maybe have other python3 installations that could be picked up by the compiler? – bernardomota Mar 10 '22 at 10:44
  • Here are some steps that you can follow to debug this problem: 1. Go to ~/Library/Logs/Homebrew/monetdb/build/CMakeCache.txt 2. Check if the **_Python3_NumPy_INCLUDE_DIR** variable is set to a Numpy include dir. If it is empty, then CMake could not find Numpy in the python3 installation it used. 3. Locate the Python3 installation that CMake is using (should be in another CMake variable such as **_Python3_EXECUTABLE** or **_Python3_EXECUTABLE**) 4. In the python installation directory that Cmake is using, go to the bin/ folder and locate pip3 5. Run pip3 install numpy – bernardomota Mar 10 '22 at 10:44