vmware-archive / vcd-cli

Command Line Interface for VMware vCloud Director
https://vmware.github.io/vcd-cli
Other
165 stars 106 forks source link

ModuleNotFoundError on FreeBSD (pysqlite2) #522

Open rohankrishnadev opened 4 years ago

rohankrishnadev commented 4 years ago

I'm running into issues with vcd-cli installed on FreeBSD. vcd seems to require a Python 2 module (pysqlite2).

[~] vcd --help
Traceback (most recent call last):
  File "/home/rohan/.local/lib/python3.7/site-packages/vcd_cli/browsercookie/__init__.py", line 18, in <module>
    from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rohan/.local/bin/vcd", line 6, in <module>
    from vcd_cli.vcd import vcd
  File "/home/rohan/.local/lib/python3.7/site-packages/vcd_cli/vcd.py", line 121, in <module>
    from vcd_cli import login  # NOQA
  File "/home/rohan/.local/lib/python3.7/site-packages/vcd_cli/login.py", line 24, in <module>
    from vcd_cli import browsercookie
  File "/home/rohan/.local/lib/python3.7/site-packages/vcd_cli/browsercookie/__init__.py", line 20, in <module>
    import sqlite3
  File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

The required module does not seem to be supported by Python 3.

[~] pip search pysqlite2
[~] pip search pysqlite3
sqlalchemy-pysqlite3 (0.0.4)  - SQLAlchemy dialect to use pysqlite3 dbapi2
pysqlite3 (0.4.2)             - DB-API 2.0 interface for Sqlite 3.x
pysqlite3-binary (0.4.2)      - DB-API 2.0 interface for Sqlite 3.x

Additional details:

[~] python --version
Python 3.7.6
[~] pip --version
pip 19.1.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
[~] freebsd-version
11.3-RELEASE-p7
vmguru007 commented 4 years ago

Hi,

I am having exactly the same issue on CentOS 8.2 where vCD CLI is installed by CSE 2.6.1. Did you get to resolve this?

vmguru007 commented 4 years ago

@rohankrishnadev I have just managed to resolve the issue above. It mainly had to do with the OS version of SQLite included in CentOS and I assume on your side Ubuntu is out of date. What I had to basically do is to download a current version of SQLite and install it from source, compile it and then reinstall Python 3.7.x.

I have documented the steps as I was working on a more detail post to install Container Service Extension when I was hit by this error so I have captured the steps to fix it and decided it to post it on a separate blog post at: http://www.virtualizationteam.com/cloud/running-vcd-cli-fail-with-the-following-error-modulenotfounderror-no-module-named-_sqlite3.html

Hope this help! I hope this will go somewhere in the documentation in the future.

@ncdc @mhoran can you please check if we should highlight this in our documentation or installation instructions. This affect both vCD CLI and CSE installation.