ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) (/thread-29571.html) Pages:
1
2
|
ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - ciuffoly - Sep-10-2020 I have compiled Python 3.8.5 and tested ok, I am on Solaris 10 system now I need to add some modules but I get these errors root@ssc50005:/sun-temp/pysftp-0.2.9$ LD_LIBRARY_PATH=/usr/lib:/usr/local/lib root@ssc50005:/sun-temp/pysftp-0.2.9$ export LD_LIBRARY_PATH root@ssc50005:/sun-temp/pysftp-0.2.9$ /usr/local/Python-3.8.5/python setup.py install Traceback (most recent call last): File "setup.py", line 3, in <module> from setuptools import setup ModuleNotFoundError: No module named 'setuptools' and also: root@ssc50005:/sun-temp/setuptools-50.3.0$ /usr/local/Python-3.8.5/python setup.py install ['/sun-temp/setuptools-50.3.0', '/usr/local/lib/python38.zip', '/usr/local/Python-3.8.5/Lib', '/usr/local/Python-3.8.5/build/lib.solaris-2.10-sun4u.32bit-3.8'] Traceback (most recent call last): File "setup.py", line 11, in <module> import _ctypes ModuleNotFoundError: No module named '_ctypes' but this module is present: root@ssc50005:/sun-temp/setuptools-50.3.0$ find /usr/local/Python-3.8.5/ -name _ctypes* /usr/local/Python-3.8.5/PCbuild/_ctypes_test.vcxproj.filters /usr/local/Python-3.8.5/PCbuild/_ctypes.vcxproj.filters /usr/local/Python-3.8.5/PCbuild/_ctypes.vcxproj /usr/local/Python-3.8.5/PCbuild/_ctypes_test.vcxproj /usr/local/Python-3.8.5/build/lib.solaris-2.10-sun4u.32bit-3.8/_ctypes_test.so /usr/local/Python-3.8.5/build/temp.solaris-2.10-sun4u.32bit-3.8/presidio_sun/SUNFREEWARE/python/Python-3.8.5/Modules/_ctypes /usr/local/Python-3.8.5/build/temp.solaris-2.10-sun4u.32bit-3.8/presidio_sun/SUNFREEWARE/python/Python-3.8.5/Modules/_ctypes/_ctypes_test.o /usr/local/Python-3.8.5/Modules/_ctypes /usr/local/Python-3.8.5/Modules/_ctypes/_ctypes_test.c /usr/local/Python-3.8.5/Modules/_ctypes/_ctypes_test.h /usr/local/Python-3.8.5/Modules/_ctypes/_ctypes.c so how to set path on python ? using PYTHONPATH to /usr/local/Python-3.8.5/Modules ? RE: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - ciuffoly - Sep-11-2020 no news ? RE: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - Larz60+ - Sep-11-2020 why are you compiling python, there are ready made binary installs here: https://www.python.org/downloads/ once you install from here you can add packages with pip install packagename
RE: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - ciuffoly - Sep-12-2020 There are no binary for Solaris 10 and my server have no access to Internet RE: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - Larz60+ - Sep-12-2020 Understood, but I'm scratching my head, I haven't been without internet since there was no web and only archie and gopher. There is this site which may proove useful: http://www.dbaglobe.com/2017/12/install-python-packages-without.html RE: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - ciuffoly - Sep-12-2020 thank you to all but my problem is not compile the Python 3.8.5. the my problem is how to add the modules. RE: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - Larz60+ - Sep-13-2020 I'm not sure if this will work, but it's worth a try. First install all of the packages that you need on a computer with internet access, using pip
Edited 9:02 PM DST Forgot important step RE: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - ciuffoly - Sep-14-2020 sorry Larz but could you more clear about the offline steps ? I have these 3 directories drwxr-xr-x 18 1000 1000 1024 Sep 11 16:16 Python-3.8.5 <<< where I have compiled the Python drwxrwxr-x 5 1000 1000 1024 Jul 6 2016 pysftp-0.2.9 <<< module to install drwxr-xr-x 7 root root 1024 Sep 5 15:27 setuptools-50.3.0 <<< probably a module necessary ls pysftp-0.2.9 LICENSE.txt PKG-INFO docs pysftp.egg-info setup.cfg MANIFEST.in README.rst pysftp requirements-dev.txt setup.py I see now at the end of compile steps there are these messages: Python build finished successfully! The necessary bits to build these optional modules were not found: _gdbm _lzma ossaudiodev To find the necessary bits, look in setup.py in detect_modules() for the module's name. The following modules found by detect_modules() in setup.py, have been built by the Makefile instead, as configured by the Setup files: _abc atexit pwd time Failed to build these modules: _ctypes Following modules built successfully but were removed because they could not be imported: _curses _curses_panel RE: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - Larz60+ - Sep-14-2020 you can use locate syntax locate modulename or find find . -name modulename both may require a 'sudo' prefix RE: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - ciuffoly - Sep-14-2020 find . -name _ctypes ./Modules/_ctypes ./build/temp.solaris-2.10-sun4u.32bit-3.8/presidio_sun/SUNFREEWARE/python/Python-3.8.5/Modules/_ctypes Have you seen the errors in the compile phase ? |