0

I am trying to extract MS Access database files using Python. I have pyodbc installed, but I keep getting the following error:

./database.mdb  ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'Microsoft Access Driver (*.mdb, *.accdb)' : file not found (0) (SQLDriverConnect)")

I've installed all of the MS database engines that I can think of (both 32 and 64 bit version), with no success. Now I am trying to install win32com which I suspect might be causing the problem, but I run into errors no matter how I try to do it.

System details: Linux x86_64, Python 3.8.5 (64 bit), Office 64bit.

So far, I have tried:

  • pip install pypiwin32
Collecting pypiwin32
  Using cached pypiwin32-223-py3-none-any.whl (1.7 kB)
  Using cached pypiwin32-219.zip (4.8 MB)
    ERROR: Command errored out with exit status 1:
     command: /home/wjo/.conda/envs/JOB33541/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l6d96gmm/pypiwin32_270a39ce0c05479e8ed8ec84f47ef9f6/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l6d96gmm/pypiwin32_270a39ce0c05479e8ed8ec84f47ef9f6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-2q1jd96_
         cwd: /tmp/pip-install-l6d96gmm/pypiwin32_270a39ce0c05479e8ed8ec84f47ef9f6/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-l6d96gmm/pypiwin32_270a39ce0c05479e8ed8ec84f47ef9f6/setup.py", line 121
        print "Building pywin32", pywin32_version
              ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Building pywin32", pywin32_version)?
  • pip install pywin32
ERROR: Could not find a version that satisfies the requirement pywin32 (from versions: none)
ERROR: No matching distribution found for pywin32
  • conda install pywin32 (and pypiwin32)
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - pywin32

Current channels:

  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

I have also tried going off and finding various different whl files (e.g. pywin32-225-cp38-cp38-win_amd64.whl) that people have apparently applied patches etc to to get them to work. None of it works.

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
WRJ
  • 617
  • 3
  • 9
  • 19
  • 2
    "Office 64bit" sounds like Windows, but "unixODBC" and "Linux x86_64" sound like Linux. Are you trying to use Python (Anaconda?) under WSL on Windows? If so, then AFAIK attempting to use the "Microsoft Access Driver (*.mdb, *.accdb)" from Windows simply won't work in WSL. – Gord Thompson Jun 01 '22 at 20:15
  • The "win"in `pywin32` stands for Windows. Same for `win32com`. Those packages are Windows-exclusive. – Erik A Jun 02 '22 at 11:34
  • https://stackoverflow.com/questions/64975918/install-win32com-on-macos-and-linux/65030870#65030870 – CristiFati Jun 04 '22 at 07:29

0 Answers0