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

the 'package' argument is required to perform a relative import #3057

Closed
1 task done
xianbaoqian opened this issue Jan 25, 2023 · 1 comment
Closed
1 task done

the 'package' argument is required to perform a relative import #3057

xianbaoqian opened this issue Jan 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@xianbaoqian
Copy link

Describe the bug

Failed to run gradio app.py due the following error.

Looks that there are some weirdness with uvicorn. Could I be installed the wrong version?

Thx

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

  • python -m venv env
  • export PATH=env/bin:$PATH
  • pip install gradio
  • gradio app.py

(env) wangtz@Tiezhens-MBP hf-puller % gradio app.py

Launching in reload mode on: http://127.0.0.1:7860 (Press CTRL+C to quit)

Watching: '/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/gradio', '.'

Process SpawnProcess-1:
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
target(sockets=sockets)
File "/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/uvicorn/server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/uvicorn/server.py", line 67, in serve
config.load()
File "/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/uvicorn/config.py", line 477, in load
self.loaded_app = import_from_string(self.app)
File "/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/importlib/init.py", line 122, in import_module
raise TypeError(msg.format(name))
TypeError: the 'package' argument is required to perform a relative import for '.Users.wangtz.projects.tools.hf-puller.app'

Screenshot

image

Logs

Watching: '/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/gradio', '.'

Process SpawnProcess-1:
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
    target(sockets=sockets)
  File "/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/uvicorn/server.py", line 67, in serve
    config.load()
  File "/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/uvicorn/config.py", line 477, in load
    self.loaded_app = import_from_string(self.app)
  File "/Users/wangtz/projects/tools/hf-puller/env/lib/python3.9/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 122, in import_module
    raise TypeError(msg.format(name))
TypeError: the 'package' argument is required to perform a relative import for '.Users.wangtz.projects.tools.hf-puller.app'

System Info

Macbook

(env) wangtz@Tiezhens-MBP hf-puller % python
Python 3.9.6 (default, Sep 26 2022, 11:37:49)
[Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import gradio
gradio.>>> gradio.__version__
'3.16.2'
>>> import uvicorn
>>> uvicorn.__version__
'0.20.0'

Severity

serious, but I can work around it

@xianbaoqian xianbaoqian added the bug Something isn't working label Jan 25, 2023
@freddyaboulton
Copy link
Collaborator

Thanks for filing @xianbaoqian !

This was fixed in #2992 and will be out in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants