Troubleshooting
This section describes some common issues that you might encounter while creating your IBM® Open Enterprise SDK for Python applications.
- Files extracted from ZIP archives have lost their sticky bit (S_ISVTX)
- IBM z/OS C/C++ Failures
- Fatal Python Error: Failed to get random numbers
- Python execution failure due to semaphore exhaustion
- Not found error for encodings module
- Errors when using setuptools
- Errors for incorrectly tagged files
- Issues building and installing PyPI packages
- Packages unable to install cffi within a virtual environment
- Redirecting to a file in a shell script results in garbled output
- UnicodeDecodeError error message
- Failure to launch the new IBM Open Enterprise SDK for Python 3.14 REPL
- Running pip without AUTOCVT results in corrupted file generation
- Error installing PyPI package using requirements.txt file encoded in EBCDIC
- ssl.SSLError: [X509: NO_CERTIFICATE_OR_CRL_FOUND] no certificate or crl found
For more troubleshooting information about multiprocessing considerations, see Multiprocessing considerations.
For more troubleshooting information about tagging files, see Tagging files.
Files extracted from ZIP archives have lost their sticky bit (S_ISVTX)
chmod +t {name_of_file}Notice that the sticky bit for directories
will not be affected.IBM z/OS C/C++ Failures
-
When using pip to install packages, they might require a C/C++ compiler. See Using IBM C/C++ compilers with IBM Open Enterprise SDK for Python for more information on setting up a C/C++ compiler.
You can test your compiler by creating a new file with the following c program:
and run#include <stdio.h> int main() { printf("Hello, world!\n"); return 0; }<path_to_your_c_compiler> <filename.c>to compile the file, and use./a.outto run it.If successful, the program will print out
Hello, world!which means your compiler is ready to use with IBM Open Enterprise SDK for Python. - While using IBM XL C/C++ 2.4.1 for z/OS 2.5, you may encounter the following
error:
FSUM3224 xlclang++: Fatal error in /usr/lpp/cbclib/xlclang/exe/clcdrvr: signal 9 receivedThis error occurs when the installation has not been completed. See Using IBM C/C++ compilers with IBM Open Enterprise SDK for Python for download address for each C/C++ compiler.
-
If your z/OS system is missing datasets which are created during the IBM z/OS XL C/C++ install process, you will encounter the following error:
You should confirm if it has been installed successfully.EDC5129I No such file or directory. (errno2=0x05940252) FSUM3221 xlc: Cannot spawn program /usr/lpp/cbclib/xlc/exe/ccndrvr - error: command '/bin/xlc' failed with exit code 255 - If a package may have been tagged incorrectly while using IBM
z/OS XL C/C++, while importing that package you will
encounter an error similar
to:
Verify if the shared library is untagged, by running:Import Error: CEE3512S An HFS load of module <path to filename.so> failed. The system return code is 0000000130 and the reason code is 0BDF0C27.
If the file is tagged, with the following output message:ls -alT <path to filename.so>
you can remove the tag with the following command:t ISO8859-1 T=onchtag -r <filename.so>
Fatal Python Error: Failed to get random numbers
-
Fatal Python error: _Py_HashRandomization_Init: failed to get random numbers to initialize PythonThis error shows up when you try to run Python without enabling Integrated Cryptographic Services Facility (ICSF). ICSF is typically responsible for supplying random data for/dev/urandom. You can run the following command to verify whether ICSF is enabled or not on your system.head -c10 /dev/urandom - If ICSF is enabled, you will see random data and if it is not enabled on your system, you will
encounter
Internal Error. If you are on z13®, you must enable Integrated Cryptographic Services Facility (ICSF) on your systems where IBM Open Enterprise SDK for Python runs.
For more information including installation guide, please refer to ICSF System Programmer's Guide and ICSF Administrator's Guide.
Python execution failure due to semaphore exhaustion
When semaphore exhaustion occurs on a machine, it can cause Python programs to fail in various ways. One common example will be an error message as follows:
_multiprocessing.SemLock(PermissionError: [Errno 139] EDC5139I Operation not permitted.
To diagnose whether semaphore exhaustion is an issue, you can run the following command to examine the number of semaphores that your user is currently using.
ipcs | grep <your ID>
If you run ipcs -y, you can get the limits for semaphores or the shared memory.
If the number reported is close to that number, then it's likely that you are hitting the limit when
running Python.
The following example shows how to approach cleaning up semaphore usage under your user id:
ipcs | grep <your ID> | awk '{print $2}' > semaphores_example.txt
for i in $(cat semaphores_example.txt) ; do { ipcrm -s $i >> /dev/null 2>&1; }; done;
for i in $(cat semaphores_example.txt) ; do { ipcrm -m $i >> /dev/null 2>&1; }; done;
rm semaphores_example.txt
Not found error for encodings module
You might run a Python script and get encodings module not found errors. The presence of the PYTHONHOME environment variable can lead to the mixing of Python versions:
$ python3
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x26b7980000000001 (most recent call first):
CEE5207E The signal SIGABRT was received.
ABORT instructionThis
error is generally caused by setting the PYTHONHOME environment variable to a
conflicting location. Try to set the PYTHONHOME environment variable and execute
Python again using the following commands:$ unset PYTHONHOME
$ python3Errors when using setuptools
-
If you see the following errors,
export the following environment variables:FSUM3010 Specify a file with the correct suffix (.C, .hh, .i, .c, .i, .s, .o, .x, .p, .I, or .a), or a corresponding data set name....export _CC_CCMODE=1 export _CXX_CCMODE=1 export _C89_CCMODE=1 export _CC_EXTRA_ARGS=1 export _CXX_EXTRA_ARGS=1 export _C89_EXTRA_ARGS=1 -
If you see the following warnings,
you can safely ignore as Python forcesWARNING CCN3236 /usr/include/unistd.h:1169 Macro name _POSIX_THREADS has been redefined.POSIXthread behavior in modules for compatibility reasons.If you see the similar error with xlc:
then setting the appropriate"/usr/include/unistd.h", line 1169.16: CCN5848 (S) The macro name "_POSIX_THREADS" is already defined with a different definition.qlanglvlwithredefmaccan be used to work around this.For both xlclang and xlc, if non-POSIX thread behavior is required, you might undefine this macro in your source files. This action should be done with care and is not recommended.
- If you see the following error while trying to install a
package:
This means the package that you are attempting to install requires a C compiler. If you have one installed in a non-standard location, you can specify it with the following command:error: command '/usr/lpp/IBM/oelcpp/v2r0/bin/clang' failed: EDC5129I No such file or directory.
If you do not have a C/C++ compiler installed on your system, see Using IBM C/C++ compilers with IBM Open Enterprise SDK for Python for obtaining a C/C++ compiler.export CC=<path to C compiler> export CXX=<path to C++ compiler>
Errors for incorrectly tagged files
-
If you see an error as the following error message:
ensure that the file is either encoded as ASCII or IBM-1047 and correctly tagged. The interpreter doesn't attempt to auto-detect the file encoding if the file is already tagged. If the file is correctly tagged and encoded, check the non-printable characters in the file.SyntaxError: Non-UTF-8 code starting with '\x84' in file test.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Issues building and installing PyPI packages
Not all packages can be built by using the default options provided in Python, and a given PyPI package may not contain compatible options for your C or C++ compiler definitions. You can often avoid compile failures, for example, changing C standard level, by using the environment variable CFLAGS.
For packages requiring C11 and later, see Using IBM C/C++ compilers with IBM Open Enterprise SDK for Python for obtaining the recommended compiler.
Import Error: CEE3512S An HFS load of module <path to filename.so> failed. The system return code is 0000000130 and the reason code is 0BDF0C27.ls -alT <path to filename.so>If the file is tagged, with the
output being similar to the following line:t ISO8859-1 T=onyou can remove the
tag with the following command:chtag -r <filename.so>Packages unable to install cffi within a virtual environment
c/_cffi_backend.c:15:10: fatal error: 'ffi.h' file not foundThis error
shows up when you try to install a package and require ffi.h file into a virtual environment without
using site-packages. IBM Open Enterprise SDK for Python is
distributed with several packages installed, including cffi. To get access when using a virtual
environment, create the environment with the flag --system-site-packages as the
following example:
<path to python3 install>/bin/python3 -m venv --system-site-packages venvRedirecting to a file in a shell script results in garbled output
export _TAG_REDIR_ERR=txt
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txtUnicodeDecodeError error message
-
This error is returned when there is a conversion error. This error message usually refers to a file that is tagged incorrectly, or has a wrong encoding specified. To verify whether the encodings are correct, see Codesets and translation for more details.UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position 0: invalid start byte
Failure to launch the new IBM Open Enterprise SDK for Python 3.14 REPL
Python 3.14.0 (heads/pyz_dev-3.14:bd1cf5a763, Oct 31 2024, 14:42:31) [Clang 18.1.0 (build 221a599)] on zos
Type "help", "copyright", "credits" or "license" for more information.
warning: can't use pyrepl:
>>>export TERMINFO=<path_to_python_install>/usr/lpp/IBM/python/v3r14/pyz/share/terminfoIf you have exported it, make sure to revert it or unset it after using IBM Open Enterprise SDK for Python.
Running pip without AUTOCVT results in corrupted file generation
Running pip without AUTOCVT causes extra files to be created. These file names use conflicting encodings that results difficulty in deleting the files.
To resolve corrupt file generation, you need to set up the correct environment variables following the instructions in the IBM Open Enterprise SDK for Python documents. For more information on how to set up environment variables, refer to Set environment variables.
export_BPXK_AUTOCVT=ON
export_CEE_RUNOPTS= “FILETAG(AUTOCVT,AUTOTAG) POSIX(ON))”- To list the inodes corresponding to each file, use the following command:
ls -iThis example shows how to use the command to list the inodes associated with each file:$> ls -i 215261 150674 activate.fish 213402 python3 183585 183584 150666 pip 213400 python3.12 215262 325137 Activate.ps1 150667 pip3 183586 150672 activate 150668 pip3.12 277227 150673 activate.csh 213401 python 183583 - To delete the generated files, use the following
command:
find . -inum <insert inum> | xargs rm –fThis example shows the usage of command:$> find . -inum 215261 | xargs rm -f
Error installing PyPI package using requirements.txt file encoded in EBCDIC
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa4 in position 0: invalid start byteiconv -T -f IBM-1047 -t ISO8859-1 requirements.txt > requirements_ascii.txtpip freeze > requirements.txtssl.SSLError: [X509: NO_CERTIFICATE_OR_CRL_FOUND] no certificate or crl found
ssl.SSLError: [X509: NO_CERTIFICATE_OR_CRL_FOUND] no certificate or crl foundEnsure
that the certificate is either encoded as ASCII or IBM-1047
and correctly tagged. ls -alT <path to the certificate>- untagged T=offchtag -tc <encoding> <path to the certificate>