Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to import plugin netbox_access_lists: Module not found. #33

Open
bytelock-id opened this issue Mar 26, 2024 · 8 comments
Open

Unable to import plugin netbox_access_lists: Module not found. #33

bytelock-id opened this issue Mar 26, 2024 · 8 comments

Comments

@bytelock-id
Copy link

After following the instructions about 45 times. Each time resulting with the same issue. After restarting netbox, I'm seeing the error in the logs. "Unable to import plugin netbox_access_lists" and it fails to start.

  1. I am running the virtual environment. Using: source /opt/netbox/venv/bin/activate
  2. I am installing the plugin. I have tried the following installation methods. (pip install --editable .) from the plugin directory as well as (python3 setup.py develop)
  3. I have checked out step 001 to make sure I didn't have a typo.
  4. I have the latest vanilla netbox.
  5. The configuratioon.py does have the correct named plugin in it.
  6. I have the most recent versions of everything Python3, Postgres, Redis, Nginx, available to Ubuntu 22 and I can confirm the vanilla version runs fine before adding any plugins.

Somethings not installing or adding correctly. etc.

@bytelock-id
Copy link
Author

The instructions I'm referring to are the how to create a plugin with Netbox.

@peteeckel
Copy link

I'm afraid you'll need to document your steps more thoroughly. Nobody can actually reproduce the problem with that kind of vague information - and I know that the instructions worked for me as I created a test plugin for issue netbox-community/netbox#15194 not so long ago following exactly the same instructions you're apparently stumbling over.

@peteeckel
Copy link

peteeckel commented Mar 28, 2024

That said, I'll venture a guess: Are you seeing this:

django.core.exceptions.ImproperlyConfigured: Unable to import plugin netbox_access_list: Module not found. Check that the plugin module has been installed within the correct Python environment.

In that case the plugin is not installed in your virtual environment. Did you use sudo for the pip install? That doesn't work well with a venv being activated with activate. And it is properly documented.

If the above assumptions are correct (remember, I'm just guessing because you didn't provide sufficient information), try

sudo /opt/netbox/venv/bin/python3 -m pip install -e [path]

with the path you checked out the plugin to instead of [path].

@bytelock-id
Copy link
Author

I'm afraid you'll need to document your steps more thoroughly. Nobody can actually reproduce the problem with that kind of vague information - and I know that the instructions worked for me as I created a test plugin for issue netbox-community/netbox#15194 not so long ago following exactly the same instructions you're apparently stumbling over.

I think we can just close this issue. I really don't care at this point anymore and I'm not going to get into some pissing match.

@amyers1616
Copy link

@bytelock-id -- I had the same issue & this helped me fix it. I too was using sudo to compile the plugin and had the module not found error.
#26 (comment)

@MohammadMortezaie
Copy link

I have same Issue

@Wigmund
Copy link

Wigmund commented Apr 26, 2024

Any ideas why I'm getting this error on this command on the last step of Step01 (everything else seemed to go smoothly):

/opt/netbox/netbox$ sudo python3 manage.py runserver
Traceback (most recent call last):
  File "/opt/netbox/netbox/manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

@peteeckel
Copy link

Yes.

You did not activate the virtual environment and did not use the full path of the python3 interpreter within the virtual environment.

At least one of the above is necessary.

With sudo, you need to do the latter:

sudo /opt/netbox/venv/bin/python3 /opt/netbox/netbox/manage.py runserver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants