netbox-community / Device-Type-Library-Import

This library is intended to assist with importing device and module types into NetBox from the NetBox Community DeviceType-Library
https://github.com/netbox-community/devicetype-library
MIT License
256 stars 77 forks source link

Issue Running import script #26

Closed ULHTNetbox closed 1 year ago

ULHTNetbox commented 3 years ago

I've followed the instructions and when I come to run the import script I get the below error message

Traceback (most recent call last): File "./nb-dt-import.py", line 2, in from git import Repo, exc, RemoteProgress ModuleNotFoundError: No module named 'git'

Netbox version 2.11.6.

Can anyone help please with resolving the issue?

Thanks

ndom91 commented 3 years ago

Looks like python is missing a git dependency. Are you executing this in a python virtual env? Have you installed the requirements? (See step 2: https://github.com/minitriga/Netbox-Device-Type-Library-Import#-getting-started)

Alternatively you could try the new docker container implementation and not have to worry about your local python environment, installing dependencies, etc., etc.

ULHTNetbox commented 3 years ago

I've tried the docker steps and that errors, netbox@netbox-b1:~$ docker build -t netbox-devicetype-import-library . unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/netbox/Dockerfile: no such file or directory

I've followed the steps, see below. I still get the error.

(venv) netbox@netbox-b1:~/Netbox-Device-Type-Library-Import$ sudo pip install -r requirements.txt Requirement already satisfied: certifi==2019.11.28 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 1)) (2019.11.28) Requirement already satisfied: chardet==3.0.4 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (3.0.4) Requirement already satisfied: gitdb2==3.0.2 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 3)) (3.0.2) Collecting GitPython==3.0.8 Using cached GitPython-3.0.8-py3-none-any.whl (450 kB) Requirement already satisfied: idna==2.8 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 5)) (2.8) Collecting progressbar2==3.47.0 Using cached progressbar2-3.47.0-py2.py3-none-any.whl (24 kB) Collecting pynetbox==4.2.5 Using cached pynetbox-4.2.5-py3-none-any.whl Requirement already satisfied: python-utils==2.3.0 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 8)) (2.3.0) Collecting PyYAML==5.4 Using cached PyYAML-5.4-cp38-cp38-manylinux1_x86_64.whl (662 kB) Requirement already satisfied: requests==2.22.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 10)) (2.22.0) Requirement already satisfied: six==1.14.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 11)) (1.14.0) Requirement already satisfied: smmap2==2.0.5 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 12)) (2.0.5) Requirement already satisfied: urllib3==1.25.8 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 13)) (1.25.8) Collecting python-dotenv==0.15.0 Using cached python_dotenv-0.15.0-py2.py3-none-any.whl (18 kB) Requirement already satisfied: wheel==0.36.2 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 15)) (0.36.2) Installing collected packages: PyYAML, python-dotenv, pynetbox, progressbar2, GitPython Attempting uninstall: PyYAML Found existing installation: PyYAML 5.3.1 ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Thanks

ndom91 commented 3 years ago

Okay I'll double check the dockerfile, seems there's some local paths of the creators in there..

Regarding the native implementation, don't use sudo pip.. cause then your using your systems native python env again when you want to be using the venv, which I see you had activated.