2

I am trying to set up an Websphere MQ Client and PYMQI on python to send/receive messages via Queue.

Environment variables have been automatically set too.

I had installed IBM MQ CLient V8.0.11 and there were not issues during.

Then, I proceeded to install (pip install pymqi) which also seemed to be file.

import pymqi

qmgr = pymqi.connect('QM.1', 'SVRCONN.CHANNEL.1', '192.168.1.121(1434)')

putq = pymqi.Queue(qmgr, 'TESTQ.1')
putq.put('Hello from Python!')

When i try to run this using Pycharm, I get the following error

enter image description here

JoshMc
  • 10,239
  • 2
  • 19
  • 38
Aakaash
  • 31
  • 4

3 Answers3

1

I have just met this problem, from my side, the reason is linux need to load the mq dll lib, but system didn't know the dll lib path, I added it to the

vi /etc/ld.so.conf.d/libc.conf

Add two line: /opt/mqm/lib64 and /opt/mqm/lib (based on where is your ibm mq lib installed) to this file:

# libc default configuration
/usr/local/lib
/opt/mqm/lib64
/opt/mqm/lib

then run the ldconfig to load the updated config:

root@ubuntu:/ibmmq# ldconfig

then the problem was fixed.

kain
  • 214
  • 2
  • 4
0

Due to the prompt, I am guessing that your client is running on windows. Before you install the pymqi library you need to need to add the MQ Client directory containing the exe's, cmd's and the dll's to the PATH. You can do this easily by running setmqenv -s.

If you attempt to install pymqi before adding the dll (lib64) directory to the PATH, then you will need to reinstall it, but make sure you use the --no-cache-dir option to force a re-install. Without --no-cache-dir the pip install will only fetch the bad object files created in your initial attempt.

chughts
  • 4,210
  • 2
  • 14
  • 27
  • 1
    Yes, My client was installed on a windows system. The path variables were automatically added after my WebSphere MQ client v8.0.11 installation. I also tried executing the **setmqenv -s** command. Received no error but wasnt sure if it made the required changes. In the end, I installed PYMQI using the no_cache_dir command but received the same error when I ran my code – Aakaash Feb 03 '20 at 15:44
  • Its `--no-cache-dir` not `no_cache_dir`. If the install is quick with no network traffic, then you are still using the cache. – chughts Feb 03 '20 at 18:27
0

The resolution to this issue is to install the latest MQ client. Then reinstall pymqi via pip with the command

pip install pymqi --no-cache-dir

With the client installed pip will have access to they below which are required for a successful compile of pymqi C:\Program Files\IBM\MQ\bin64 C:\Program Files\IBM\MQ\bin C:\Program Files\IBM\MQ\tools\c\samples\bin64 C:\Program Files\IBM\MQ\tools\c\samples\bin