-
Notifications
You must be signed in to change notification settings - Fork 7
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
No module named 'punctuator.punc'; 'punctuator' is not a package #3
Comments
How are you calling it? |
Hi Chris, We've tried: As well as executing from the command line and then reading it from a file: os.system("tesseract -l eng /var/app/current/inputs/" + str(i) + ".png text") Thanks for getting back so quickly. |
I meant how are you calling punctuator. That code only appears to call tesseract. |
Sorry! Here is the function we are using punctuator in: def punctuate_transcript(text): We import Punctuator at the top of the file with: from punctuator import Punctuator and I've made sure to download the model, Demo-Europarl-EN.pcl, to the right place, both locally and on AWS. |
I meant a complete script to reproduce the issue. Try this:
Does that throw an import error? |
With or without the virtualenv, it does not throw an import error. Do you think we can use the os package to run Punctuator in Python from the command line within our application? |
I'm not sure I understand your question. If you mean calling punctuator via os.system(), I suppose that could work, but that's a complicated workaround to what should be a simple problem to fix. If your application is running inside the virtualenv where punctuator is installed, it'll just work and you should need to call punctuator it via os.system. It looks like it's throwing an import error because you simply haven't installed punctuator. If you're somehow calling punctuator from Python running |
I've been having the same issue when importing it via python with |
I'm having the same problem |
If someone could provide a script that reproduces the problem, then I could probably fix it. However, I can find no problems on my end. I even have a Travis build that installs the package and runs some unittests. Closing this as not-reproducible, but feel free to re-open if you can document steps to reproduce. |
Hi! Happy NY and Merry Christmas :) Dockerfile: app/main.py: from fastapi import FastAPI RUN Error occured |
@evios Thanks. I can reproduce this. I can also reproduce this if I use a normal venv in Ubuntu. However, it seems to be a bug in uvicorn, not this package. That's why I couldn't reproduce this earlier, as I was only testing with a normal Python shell. If I add
However, if I run a normal Python shell and then do the same import, I see:
So for some odd reason, it looks like uvicorn is adding the standard bin directory as a place to look for packages, and this is breaking because I have a bin script with the same name as the package. So it tries to import the bin script, which obviously isn't a package, causing the ModuleNotFoundError. I don't think this behavior in uvicorn is correct. It should not be looking for packages in the virtualenv's bin directory. Therefore, I don't think there's anything I can do on my end, short of changing my names to conform to uvicorn's non-standard behavior, which isn't good practice. Correct me if I'm wrong. |
Also, as a workaround, if you remove the bin directory from sys.path before you import punctuator, that should fix it. |
Thanks @chrisspen ,It worked.
|
Hi:) In such run scenario everything good. |
Hi, I have these system paths: ['/mnt/c/PythonProgrammes/venv', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages'] (running Python 3.7 on Ubuntu 18.04 LTS) I have tried to removing '/mnt/c/PythonProgrammes/venv' with: sys.path.remove('/mnt/c/PythonProgrammes/venv') But my installed_packages_list does not include punctuator. Any help appreciated. |
I'm currently trying to create a webapp, Punctuator being an important package for it. I'm using AWS, which is "a distribution that evolved from Red Hat Enterprise Linux (RHEL) and CentOS," but I'm not sure about specifics. I'm on Python 3.7.9, and these are the errors that come out -
~ File "/var/app/venv/staging-LQM1lest/bin/punctuator.py", line 5, in
~ from punctuator.punc import command_line_runner
~ ModuleNotFoundError: No module named 'punctuator.punc'; 'punctuator' is not a package
I installed puncuator 0.9.6 into the virtual environment venv via a requirements.txt file off of github, with the following command:
sudo pip3 install -r https://raw.githubusercontent.com/wcooper90/summarization/master/backend/requirements.txt
I also have Punctuator installed on Amazon Linux 2 with just pip3 install puncuator.
I'm wondering if there are some dependency issues, or if it may have to do with the OS?
Thanks for any help.
The text was updated successfully, but these errors were encountered: