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)
#7
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
  • All of the following on computer with internet:
    • create a virtual environment In a new directory, using python 3.8.5 with python -m venv venv
    • activate the virtual environment with command: . ./venv/bin/acctivate
    • Upgrade pip to eliminate annoying warnings: pip install --upgrade pip
    • check to see if the packages are already installed on the internet computer with pip list
    • download missing packages with pip install packagename
    • copy all missing (only) packages from venv/lib/python3.8/site-packages to thumb drive in a lib/site_packages directory.
    • Do the same for venv/lib64/python3.8/site-packages and save on thumb drive lib64/site_packages directory.
    • libraries have to be installed with yum, or apt-get (depending on your distro, can check with which yum or which apt
    • for these libraries, first see if they are already installed,
      look in /usr/share/doc/ if there, create a user/share/doc directory (on thumb drive) and copy there
    • if not there install (preferable to use synaptic package manager, but you can also use: sudo apt-get install libffi-dev
      do the same for all libraries and then copy to thumb drive
    • deactivate
    • remove venv diretory you created earlier.
  • on computer with out internet:
    • copy libaries from thumb drive to /usr/share/doc/ (use sudo)
    • copy pip files to venv/lib/python3.8/site-packages and venv/lib64/python3.8/site-packages respectively.

Edited 9:02 PM DST Forgot important step
Reply


Messages In This Thread
RE: ImportError: cannot import name 'Union' from '_ctypes' (unknown location) - by Larz60+ - Sep-13-2020, 01:02 AM

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