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

ModuleNotFoundError: No module named 'PyInstaller' #356

Closed
Dammi87 opened this issue Mar 5, 2019 · 10 comments
Closed

ModuleNotFoundError: No module named 'PyInstaller' #356

Dammi87 opened this issue Mar 5, 2019 · 10 comments
Assignees

Comments

@Dammi87
Copy link

Dammi87 commented Mar 5, 2019

When publishing my Python module, I get the following error
ModuleNotFoundError: No module named 'PyInstaller'

Which happens when I run this command
func azure functionapp publish <name> --build-native-deps

Even though I can see that it has installed properly during the build.

Adding the --no-bundle does not work either (I added PyInstaller to requirements.txt, remove it there as well to verify)

Investigative information

Please provide the following:

  • Timestamp:
  • Function App name: NA
  • Function name(s) (as appropriate):
  • Core Tools version:
    • func --version: 2.3.199
    • docker 18.06.1-ce-win73 (19507)
    • OS Windows 10

Repro steps

repro.zip

Expected behavior

When I tried the same command around a month ago, it worked perfectly fine. My build also works fine locally.

Actual behavior

Provide a description of the actual behavior observed.

Other info

Getting site publishing info...
Running 'docker pull mcr.microsoft.com/azure-functions/python:2.0'..done
Running 'docker run --rm -d mcr.microsoft.com/azure-functions/python:2.0'...done
Running 'docker exec -t 73d715 mkdir -p /home/site/wwwroot/'..done
Running 'docker cp C:\Users\AdamFjelsted\AppData\Local\Temp\tmpE919tmp/. 73d715:/home/site/wwwroot'..done
Running 'docker cp C:\Users\Adam.Fjelsted\AppData\Local\Temp\tmpFCF0.tmp 73d715:python_docker_build.sh'..done
Running 'docker cp C:\Users\Adam.Fjelsted\AppData\Local\Temp\tmpFD01.tmp 73d715:python_bundle_script.py'..done
Running 'docker exec -t 73d715 chmod +x /python_docker_build.sh'..done
Running 'docker exec -t 73d715 chmod +x /python_bundle_script.py'..done
Running 'docker exec -t 73d715 /python_docker_build.sh'..................done
Running 'docker kill 73d715'..done
Error running docker exec -t 73d7157c13353760e69744753f6cb0def42400785013b610e2c0bc80d9003aa5 /python_docker_build.sh.

@ankitkumarr
Copy link
Contributor

ankitkumarr commented Mar 9, 2019

This is related to Pyinstaller having issues with pip 19.0 @(pyinstaller/pyinstaller#4003). See workaround- Azure/azure-functions-core-tools#1100

I can make an update to work around this problem when I am back.

@ankitkumarr
Copy link
Contributor

Oh, and the workaround flag is --no-bundler and not --no-bundle.

@IainColledge
Copy link

IainColledge commented Mar 14, 2019

func azure functionapp publish funcname --build-native-deps --no-bundler --force fails for some reason.

Installing build dependencies ... done
  Getting requirements to build wheel ... error
  Complete output from command /root/.pyenv/versions/3.6.8/bin/python3.6 /root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpopca83q5:
  Traceback (most recent call last):
    File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
      main()
    File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 54, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-br3aghgk/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 130, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-br3aghgk/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 112, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-br3aghgk/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 126, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 20, in <module>
      from PyInstaller import __version__ as version, HOMEPATH, PLATFORM
  ModuleNotFoundError: No module named 'PyInstaller'

  ----------------------------------------
Command "/root/.pyenv/versions/3.6.8/bin/python3.6 /root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpopca83q5" failed with error code 1 in /tmp/pip-install-k7msq614/pyinstaller
You are using pip version 19.0, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

@maiqbal11
Copy link
Contributor

maiqbal11 commented Mar 14, 2019

Can you share your requirements.txt? Might be the case that you still have PyInstaller listed in your requirements even though it is not required for the --no-bundler path. pip 19.0 has issues with installing PyInstaller so that would lead to issues.

@IainColledge
Copy link

Thanks for the reply, this is the requirements.txt

asn1crypto==0.24.0
astroid==2.1.0
azure-common==1.1.18
azure-cosmosdb-nspkg==2.0.2
azure-cosmosdb-table==1.0.5
azure-functions==1.0.0b3
azure-functions-worker==1.0.0b3
azure-nspkg==3.0.2
azure-storage-common==1.4.0
certifi==2018.11.29
cffi==1.11.5
chardet==3.0.4
cryptography==2.5
grpcio==1.14.2
grpcio-tools==1.14.2
idna==2.8
isort==4.3.4
lazy-object-proxy==1.3.1
mccabe==0.6.1
mypy==0.670
mypy-extensions==0.4.1
protobuf==3.6.1
ptvsd==4.2.3
pycparser==2.19
pylint==2.2.2
python-dateutil==2.8.0
requests==2.21.0
six==1.12.0
typed-ast==1.3.1
urllib3==1.24.1
wrapt==1.11.1

@maiqbal11
Copy link
Contributor

@IainColledge, can you try upgrading pip to 19.03 for now? A fix was released in 19.02: pypa/pip#6163 (comment).

@Dammi87, realized that you were the one who had originally posted the issue. Is it resolved now?

@IainColledge
Copy link

Isn't this the pip in the docker container that is being run, not the host?

On the host am running 18.1

@maiqbal11
Copy link
Contributor

@IainColledge, yes, you're correct. This is running in the Docker and I can see that 19.0 is the current pip version in Docker. Is this the first error you see when you run publish or is there a stack before this?

@ahmelsayed, did we make any changes recently that might cause this error to manifest? Can we update the image to use pip 19.3? I'm also not sure why this would get triggered in the --no-bundler path since that does not use PyInstaller.

@IainColledge
Copy link

Thanks, yup this is the first error.

Updating the image to pip 19.3 would be awesome.

@asavaritayal
Copy link
Contributor

This should now be fixed in the base docker image - https://github.com/docker-library/python/blob/fac7efee47f0c188f3ea21a328ec3109612fd0cf/3.6/stretch/slim/Dockerfile#L103. Please feel free to re-open if you still see any issues.

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