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

Cannot install ngrok-api and ngrok packages at the same time #30

Open
acodeninja opened this issue Jan 18, 2024 · 4 comments
Open

Cannot install ngrok-api and ngrok packages at the same time #30

acodeninja opened this issue Jan 18, 2024 · 4 comments
Assignees

Comments

@acodeninja
Copy link

Replication:

  • Install the ngrok SDK pip install ngrok
  • Install the ngrok API client pip install ngrok-api
  • Create a new file called test.py
    import ngrok
    
    ngrok.forward("http://localhost:8080")
  • python test.py

Results in:

Traceback (most recent call last):
  File "test/test.py", line 3, in <module>
    ngrok.forward("http://localhost:8080")
    ^^^^^^^^^^^^^^
AttributeError: module 'ngrok' has no attribute 'forward'

Cause

The package ngrok and ngrok-api both contain the same published package folder ngrok. ngrok-api seems to take precedence:

ls python3.11/site-packages/ngrok
__init__.py     __main__.py     __pycache__     client.py       datatypes.py    error.py        http_client.py  iterator.py     mypy.ini        ngrok.abi3.so   ngrok.pyi       ngrok_parser.py py.typed        services.py     utils.py

Suggested fix

Update this package to expose the package directory ngrok_api which might be a better choice.

@salilsub
Copy link

@acodeninja can you provide more context on why you are using both packages? Specifically interested in what you are using the ngrok-api package for.

@salilsub salilsub self-assigned this Feb 22, 2024
@acodeninja
Copy link
Author

acodeninja commented Feb 24, 2024

Hi, thanks for taking a look @salilsub. The specific use case was for a Python app, live-questions.

The app hosts a flask application over an ngrok tunnel and presents a TUI app with a QR Code pointing to the ngrok domain.

I wanted to use this library to retrieve a list of ngrok domains for users to choose from. As a workaround I've used various subprocess.call instances to get the information needed from the ngrok CLI.

These calls are usually very fragile when working cross-os so I'd like to use both libraries. I also feel both the ngrok and ngrok-api packages should be capable of being installed at the same time.

@russorat russorat assigned russorat and unassigned salilsub Jul 29, 2024
@WesTyler
Copy link

I just ran into the same. I'm trying to create a reserved address (api lib) and then use that address to connect a TCP tunnel (sdk lib).

@thrau
Copy link

thrau commented Aug 18, 2024

I'm running into the same limitation, which is blocking me from using ngrok-api. I'm using the ngrok agent sdk to create and manage tunnels for the user programmatically, and I want to use the ngrok api in the same app to do things like list the available custom domains.

A solution could be to use namespace packages

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