Python Forum
ImportError: cannot import name 'Union' from '_ctypes' (unknown location)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ImportError: cannot import name 'Union' from '_ctypes' (unknown location)
#11
I have never had to compile, use pyenv see: https://python-forum.io/Thread-pyenv-Sim...ight=pyenv
If I do normal install, Ialways use install packages from python.org
Reply
#12
bash-3.2# PYTHONPATH=/usr/local/lib/python2.7/distutils
bash-3.2# export PYTHONPATH
bash-3.2# pwd
/sun-temp/pysftp-0.2.9
bash-3.2# /usr/local/bin/python setup.py install
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site.py", line 563, in <module>
main()
File "/usr/local/lib/python2.7/site.py", line 545, in main
known_paths = addusersitepackages(known_paths)
File "/usr/local/lib/python2.7/site.py", line 278, in addusersitepackages
user_site = getusersitepackages()
File "/usr/local/lib/python2.7/site.py", line 258, in getusersitepackages
from sysconfig import get_path
ImportError: cannot import name get_path
Reply
#13
python 2.7 is kaput, reached end of life January 1 of this year.
Again if for some reason you must use this version, it's a snap to install with pyenv
see: Pyenv - simple python version management
Reply
#14
sorry Larz but I don't understand

first I have a configure error (solved) and a compiler error (still to solve)

root@crbosrv2:/presidio_sun/SUNFREEWARE/python/Python-3.8.5$ ./configure
checking build system type... sparc-sun-solaris2.10
checking host system type... sparc-sun-solaris2.10
checking for python3.8... python3.8
....
checking whether float word ordering is bigendian... unknown
configure: error:
Unknown float word ordering. You need to manually preset
ax_cv_c_float_words_bigendian=no (or yes) according to your system.

This first problem has been solved with:

find /usr -name ggrep
/usr/sfw/bin/ggrep
PATH=$PATH:/usr/sfw/bin
export PATH

root@crbosrv2:/presidio_sun/SUNFREEWARE/python/Python-3.8.5$ ./configure
checking build system type... sparc-sun-solaris2.10
checking host system type... sparc-sun-solaris2.10
....
config.status: creating Modules/ld_so_aix
config.status: creating pyconfig.h
config.status: pyconfig.h is unchanged
creating Modules/Setup.local
creating Makefile

root@crbosrv2:/presidio_sun/SUNFREEWARE/python/Python-3.8.5$ make
gcc -c -fno-strict-aliasing -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -D_REENTRANT -std=c99 -Wextra -Wno-unused-parameter -I./Include/internal -I. -I./Include -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
......
INFO: Could not locate ffi libs and/or headers
*** WARNING: renaming "_curses" since importing it failed: ld.so.1: python: fatal: relocation error: file build/lib.solaris-2.10-sun4u.32bit-3.8/_curses.so: symbol _unctrl: referenced symbol not found
*** WARNING: renaming "_curses_panel" since importing it failed: No module named '_curses'

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

running build_scripts
Reply
#15
If I start from compiled package cannot add modules

pkgadd -d python-3.2.2-sol10-sparc-local

The following packages are available:
1 SMCpyth3 python
(sparc) 3.2.2

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 1

Processing package instance <SMCpyth3> from </presidio_sun/SUNFREEWARE/python/python-3.2.2-sol10-sparc-local>

python(sparc) 3.2.2
The Python Group
Using </usr/local> as the package base directory.
## Processing package information.
## Processing system information.
8 package pathnames are already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

Installing python as <SMCpyth3>

## Installing part 1 of 1.
/usr/local/bin/2to3 <symbolic link>
/usr/local/bin/2to3-3.2
/usr/local/bin/idle3 <symbolic link>
/usr/local/bin/idle3.2
/usr/local/bin/pydoc3 <symbolic link>
/usr/local/bin/pydoc3.2
/usr/local/bin/python3
/usr/local/bin/python3-config <symbolic link>
........

/usr/local/bin/python3
Python 3.2.2 (default, Nov 16 2011, 05:23:55)
[GCC 3.4.6] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>>

cd pysftp-0.2.9$
/usr/local/bin/python3 setup.py install
Traceback (most recent call last):
File "setup.py", line 3, in <module>
from setuptools import setup
ImportError: No module named setuptools

/usr/local/bin/python3
Python 3.2.2 (default, Nov 16 2011, 05:23:55)
[GCC 3.4.6] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/lib/python32.zip', '/usr/local/lib/python3.2', '/usr/local/lib/python3.2/plat-sunos5', '/usr/local/lib/python3.2/lib-dynload', '/usr/local/lib/python3.2/site-packages']
>>>

find /usr/local/ -name _socket*
/usr/local/lib/python3.8/site-packages/_socket.so
/usr/local/lib/python3.8/lib-dynload/_socket.so
Reply
#16
can you help me with these modules ?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Cannot import easysnmp: ImportError: libnetsnmp.so.30 Calab 4 1,058 Jun-08-2023, 08:52 PM
Last Post: Gribouillis
  ImportError: cannot import name 'Pyfhel' from 'Pyfhel' Anldra12 9 3,574 Dec-13-2021, 06:55 PM
Last Post: Anldra12
  ImportError: cannot import name 'get_config' russray2008 0 4,761 Sep-20-2021, 02:18 PM
Last Post: russray2008
  Inheritance vs Union gserranowong 3 2,254 Jun-29-2021, 06:13 PM
Last Post: gserranowong
  ImportError: cannot import name 'Request' from 'request' abhishek81py 1 3,945 Jun-18-2020, 08:07 AM
Last Post: buran
  ImportError: cannot import name 'MidiEvaluator' from 'parser' (Windows 10) spiffspaceman 4 2,696 May-22-2020, 10:16 PM
Last Post: snippsat
  ImportError: cannot import name 'X ' from ' Y' (Unknown location) Arjunpi 1 4,369 Apr-30-2020, 12:56 AM
Last Post: Larz60+
  Lists union and intersecion arbiel 5 2,854 Mar-28-2020, 05:57 AM
Last Post: buran
  Where could I get _ctypes module except libffi-dev? Snake 7 8,296 Jan-17-2020, 11:10 AM
Last Post: Larz60+
  problem with mapnik in anaconda python 2: from _mapnik import * ImportError: DLL load parsley 0 1,912 Dec-11-2019, 07:50 AM
Last Post: parsley

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020