ibmdb / python-ibmdb

Automatically exported from code.google.com/p/ibm-db
Apache License 2.0
305 stars 191 forks source link

Unable to install ibm-db on python:3.11.2-slim-buster image on MacOS M1 Chip System, need to find a image that works on building ibm_db #835

Closed j-mon closed 1 year ago

j-mon commented 1 year ago

Error:

0 3.188 File "/tmp/pip-build-env-nkbtdim_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 335, in run_setup

0 3.188 exec(code, locals())

0 3.188 File "", line 350, in

0 3.188 NameError: name 'arch_' is not defined

0 3.188 [end of output]

Steps to Reproduce:

  1. add ibm-db-sa and ibm-db to requirements.txt
  2. docker-compose up -d --build
Earammak commented 1 year ago

@j-mon, The problem you are pointing for python 3.11 and the error mentioned here is for python 3.9. Can you please share the complete output of "pip install ibm_db".

bimalkjha commented 1 year ago

Steps to install ibm_db on arm64 architecture - MacOS M1/M2 Chip System

Install x86_64 gcc@12 on M1/M2 Chip System

Warning: If you use the ARM version of homebrew (as recommended for M1 architectures) you will get the following error message:

$ brew install gcc-12
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
  https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
  brew bundle dump

Install gcc@12 using homebrew (note: the x86_64 version of homebrew is needed for this, not the recommended ARM based homebrew). The clearest instructions on how to install and use the x86_64 version of homebrew is by following below steps:

Steps to Install Intel Python after verifying setup

Install ibm_db with x86_64 version of gcc8 and python on M1 Chip System

If you are getting error: Symbol not found: ___cxa_throw_bad_array_new_length

bimalkjha commented 1 year ago

@j-mon I hope you are able to install ibm_db using right steps now. Please let us know if we can close this issue? Thanks.

bimalkjha commented 1 year ago

export ARCHFLAGS="-arch x86_64"

stealthco-tony commented 7 months ago

Can we just "update the pypi package" instead of needing a complete separate homebrew/compiling from source workaround? This isn't meeting users where they are at all; in fact, its the complete opposite. Thanks.

bimalkjha commented 7 months ago

@stealthco-tony The latest version of ibm_db do not need compiler as it comes as a precompiled wheel package. But you need x64 version of python to install ibm_db. Thanks.

IsraAgus commented 1 month ago

Hi, I followd the steps and this is the output: ImportError Traceback (most recent call last) Cell In[8], line 1 ----> 1

import ibm_db

ImportError: dlopen(/Users/israelvargas/Documents/IBM Proyectos/MATT/Projects/Finanzas/.venv/lib/python3.9/site-packages/ibm_db.cpython-39-darwin.so, 0x0002): Symbol not found: ZNKSt8detail20_Prime_rehash_policy14_M_need_rehashEmmm Referenced from: <803DFCA0-2956-3B4C-B633-4BCFBAA8B43A> {path_to_local_enviroment}/libdb2.dylib Expected in: <3FE24BF6-7E7F-338E-B009-41FD96FDB569> /usr/lib/libstdc++.6.dylib

Python version: 3.9 gcc -v: x86_64-apple-darwin23.6.0 This is a virtual environment created based on 3.9 Python intel. I think that it is similar to the expected error that you mentioned in the instructions, but I cannot solve it yet. Is there any hint?

j-mon commented 1 month ago

It’s impossible to solve it’s a crazy bug let me know how it goes lol

Jeffrey Monsalve

Stevens Institute of Technology | 2022 Rutgers University | 2017 | Mobile: (201)-850-2684 |

http://www.linkedin.com/in/jemonsalve/

On Fri, Sep 6, 2024 at 7:32 PM Israel Vargas @.***> wrote:

Hi, I followd the steps and this is the output: ImportError Traceback (most recent call last) Cell In[8], line 1 ----> 1

import ibm_db

ImportError: dlopen(/Users/israelvargas/Documents/IBM Proyectos/MATT/Projects/Finanzas/.venv/lib/python3.9/site-packages/ ibm_db.cpython-39-darwin.so, 0x0002): Symbol not found: ZNKSt8detail20_Prime_rehash_policy14_M_need_rehashEmmm Referenced from: <803DFCA0-2956-3B4C-B633-4BCFBAA8B43A> {path_to_local_enviroment}/libdb2.dylib Expected in: <3FE24BF6-7E7F-338E-B009-41FD96FDB569> /usr/lib/libstdc++.6.dylib

Python version: 3.9 gcc -v: x86_64-apple-darwin23.6.0 This is a virtual environment created based on 3.9 Python intel. I think that it is similar to the expected error that you mentioned in the instructions, but I cannot solve it yet. Is there any hint?

— Reply to this email directly, view it on GitHub https://github.com/ibmdb/python-ibmdb/issues/835#issuecomment-2334937764, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKU7SUOCPB7PANOTKUQG3TZVI3QHAVCNFSM6AAAAAAWNQWVFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZUHEZTONZWGQ . You are receiving this because you were mentioned.Message ID: @.***>

j-mon commented 1 month ago

I think it’s missing a file in a path ?

Jeffrey Monsalve

Stevens Institute of Technology | 2022 Rutgers University | 2017 | Mobile: (201)-850-2684 |

http://www.linkedin.com/in/jemonsalve/

On Fri, Sep 6, 2024 at 7:33 PM Jeffrey Monsalve @.***> wrote:

It’s impossible to solve it’s a crazy bug let me know how it goes lol

Jeffrey Monsalve

Stevens Institute of Technology | 2022 Rutgers University | 2017 | Mobile: (201)-850-2684 |

http://www.linkedin.com/in/jemonsalve/

On Fri, Sep 6, 2024 at 7:32 PM Israel Vargas @.***> wrote:

Hi, I followd the steps and this is the output: ImportError Traceback (most recent call last) Cell In[8], line 1 ----> 1

import ibm_db

ImportError: dlopen(/Users/israelvargas/Documents/IBM Proyectos/MATT/Projects/Finanzas/.venv/lib/python3.9/site-packages/ ibm_db.cpython-39-darwin.so, 0x0002): Symbol not found: ZNKSt8detail20_Prime_rehash_policy14_M_need_rehashEmmm Referenced from: <803DFCA0-2956-3B4C-B633-4BCFBAA8B43A> {path_to_local_enviroment}/libdb2.dylib Expected in: <3FE24BF6-7E7F-338E-B009-41FD96FDB569> /usr/lib/libstdc++.6.dylib

Python version: 3.9 gcc -v: x86_64-apple-darwin23.6.0 This is a virtual environment created based on 3.9 Python intel. I think that it is similar to the expected error that you mentioned in the instructions, but I cannot solve it yet. Is there any hint?

— Reply to this email directly, view it on GitHub https://github.com/ibmdb/python-ibmdb/issues/835#issuecomment-2334937764, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKU7SUOCPB7PANOTKUQG3TZVI3QHAVCNFSM6AAAAAAWNQWVFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZUHEZTONZWGQ . You are receiving this because you were mentioned.Message ID: @.***>

bimalkjha commented 4 weeks ago

@IsraAgus Please share output of below commands to understand your system environment:

otool -L /Users/israelvargas/Documents/IBM Proyectos/MATT/Projects/Finanzas/.venv/lib/python3.9/site-packages/ibm_db.cpython-39-darwin.so
gcc -v  => complete output.
echo $DYLD_LIBRARY_PATH
ls /usr/local/Homebrew/Cellar/gcc

Also, check troubleshooting instructions as documented here: https://github.com/ibmdb/python-ibmdb/blob/master/INSTALL.md#-4-troubleshooting-post-install-errors Thanks.

IsraAgus commented 4 weeks ago

Hello,

It works now for me. As you mentioned @bimalkjha, I committed a mistake when I configured the environment variable for the file: libstdc++.6.dylib. The simplest solution is in the last tutorial you shared in the troubleshooting section: https://github.com/ibmdb/python-ibmdb/blob/master/INSTALL.md#-4-troubleshooting-post-install-errors

It is crucial to mention that when you start the installation and all the stuff, be sure that the zsh prompt is running in the x86 architecture; otherwise, the installation will not work.

For future readers: