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

Pip Install Missing Core Files #1656

Open
pag08007 opened this issue Nov 30, 2020 · 3 comments
Open

Pip Install Missing Core Files #1656

pag08007 opened this issue Nov 30, 2020 · 3 comments

Comments

@pag08007
Copy link

pag08007 commented Nov 30, 2020

Describe the bug

So we are trying to deploy our python code to MS Azure's Function Platform.

When we do a pip install on our local machine using our requirements.txt file nengo installs successfully and we have no issues.
But when we try and deploy to our Azure Function the deployment framework says that it successfully pip installed nengo. But when we look at the package that was actually installed it seems to be missing all python files except a file named nengorc. So when we try import nengo we get a "module can't be found" error because we can't find the nengo module we are trying to import, such as connections.py

I currently have a ticket open with Microsoft and they are researching this ticket on their end. But I just wanted to open a ticket here to see if there are any reasons that can be thought off as to why a pip install of nengo would not include the core python files (such as connections.py) and instead only includes the nengorc file.

I've included a screenshot below to show us SSH'd into the VM and you can see that inside the nengo package exists only one file
image

To reproduce

Ultimately, the code required to reproduce this is minimal essentially try and import a module from nengo and you will get a failure.

import logging
from nengo import Connection as BaseConnection

import azure.functions as func


def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

Expected behavior

We expect that no matter where we are pip installing this module that it will install successfully.

Error message and logs

Result: Failure Exception: ImportError: cannot import name 'Connection' from 'nengo' (unknown location). Troubleshooting Guide: https://aka.ms/functions-modulenotfound Stack: File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/dispatcher.py", line 275, in _handle__function_load_request func_request.metadata.entry_point) File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 34, in call raise extend_exception_message(e, message) File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 32, in call return func(*args, **kwargs) File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/loader.py", line 76, in load_function mod = importlib.import_module(fullmodname) File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 953, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/home/site/wwwroot/SampleNengoSvc/init.py", line 2, in from nengo import Connection as BaseConnection

Versions

  • OS: Linux
  • Python: venv Python 3.7
  • Nengo: 2.8.0
  • Other: NumPy 1.18.1, nengolib 0.5.2

Additional context

N/A

@tbekolay
Copy link
Member

tbekolay commented Dec 1, 2020

This is very unlikely to be an issue with Nengo, since we use the standard setuptools infrastructure to make Nengo pip-installable. Still, this is pretty weird, so I'm curious to know what's going on. Could you share the line that you have in requirements.txt that lists Nengo? Could you also look at what else is in site-packages? For me, because I do a developer installation, I do not have a site-packages/nengo folder, I instead have site-packages/nengo.egg-link file that points to a cloned git repository. If you're installing from git, that might also be true for you. If that's the case, then the weirder part is that nengorc is showing up in site-packages/nengo; for me, this file does not get copied to my site packages, which might also be because I'm using a dev installation.

@pag08007
Copy link
Author

pag08007 commented Dec 2, 2020

So in our requirements.txt file we have the following line:
nengolib==0.5.2

This version of nengolib should install nengo version 2.8.0.

I also tried explicitly adding nengo==2.8.0 to my requirements.txt and I got the same issue.

When I pip install nengo/nengolib locally I get all of the expected python files installed and am able to reference them as you would expect. It is only when I deploy Microsoft's Azure Function platform where we get this weird error. Weirdly enough, I actually tried one of Microsoft's other supported platforms (Azure App Services) and I did not encounter this issue. Everything worked as expected. So this issue does seem to be related very specifically for Azure Functions.

Also, we are not installing it from git. I believe we should be installing from PyPi.

I've also included a screenshot below of nengo and nengolib that are in the site-packages.

image

@jgosmann
Copy link
Collaborator

jgosmann commented Dec 3, 2020

In the Nengo 2.8.0 wheel are three folders: nengo, nengo-2.8.0.data (containing the single file data/nengo/nengorc), and nengo-2.8.0.dist-info. It seems that for some reason the content of nengo-2.8.0.data/data overwrites nengo. Maybe it is possible to force installation from the source .tar.gz instead of the wheel? No idea whether that would work around the issue.

btw: Is it possible to find out the exact pip version used by Azure Functions?

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

No branches or pull requests

3 participants