thammo4 / uvatradier

Python wrapper for the Tradier brokerage API
Apache License 2.0
16 stars 12 forks source link

pip install uvatradier results in ModuleNotFoundError #19

Open Enuratique opened 11 months ago

Enuratique commented 11 months ago

I do my Python development in an official Python 3 docker image. I have a RUN command to pip install my dependencies.

I can confirm uvatradier is installed by running the pip show uvatradier command:

root@ubuntu:/script# pip show uvatradier
Name: uvatradier
Version: 0.2.1
Summary: wahoowah
Home-page: https://github.com/thammo4/uvatradier
Author: tom hammons
Author-email: 
License: 
Location: /usr/local/lib/python3.9/dist-packages
Requires: 
Required-by: 

I do this for all of my dependencies and there isn't an issue. However, when I have this import statement, it raises a ModuleNotFoundError: uvatradier:

from uvatradier import Quotes

Is uvatradier somehow not compatible with Python3?

Enuratique commented 11 months ago

I'll note that pip says uvatradier has no dependencies when you run pip show uvatradier, but looking at the code it does require requests at a minimum

thammo4 commented 11 months ago

Hi! Thanks for pointing out the lack of dependency specification. That will get updated shortly.

For the ModuleNotFound error - uvatradier should work with python3. Perhaps trying to import uvatradier in a different setting (e.g. jupyter notebook or from command line) would help to determine whether Docker or uvatradier is the issue?

I have Python3 installed on my local machine. When I import the package, everything seems fine, so I'm inclined to believe that it is compatible with Python3. Below is the output I get when running python3 from my terminal:

bash-3.2$ pip3 show uvatradier
Name: uvatradier
Version: 0.2.1
Summary: wahoowah
Home-page: https://github.com/thammo4/uvatradier
Author: tom hammons
Author-email: 
License: 
Location: /opt/homebrew/lib/python3.11/site-packages
Requires: 
Required-by: 
bash-3.2$ python3
Python 3.11.5 (main, Aug 24 2023, 15:09:32) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from uvatradier import Tradier, Account, Quotes
wahoowah
>>> 
thammo4 commented 11 months ago

The requirement specifications are all set now. I would recommend pip uninstalling uvatradier and then running pip install uvatradier==0.2.2 (or pip3). Then the requirements should appear:

bash-3.2$ pip3 show uvatradier
Name: uvatradier
Version: 0.2.2
Summary: wahoowah
Home-page: https://github.com/thammo4/uvatradier
Author: tom hammons
Author-email: 
License: 
Location: /opt/homebrew/lib/python3.11/site-packages
Requires: pandas, requests
Required-by: 
bash-3.2$ 
Enuratique commented 11 months ago

Thanks, will give it a try and report back.

On Wed, Dec 20, 2023 at 7:51 PM thammo4 @.***> wrote:

The requirement specifications are all set now. I would recommend pip uninstalling uvatradier and then running pip install uvatradier==0.2.2 (or pip3). Then the requirements should appear:

bash-3.2$ pip3 show uvatradier Name: uvatradier Version: 0.2.2 Summary: wahoowah Home-page: https://github.com/thammo4/uvatradier Author: tom hammons Author-email: License: Location: /opt/homebrew/lib/python3.11/site-packages Requires: pandas, requests Required-by: bash-3.2$

— Reply to this email directly, view it on GitHub https://github.com/thammo4/uvatradier/issues/19#issuecomment-1865326885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5KMF2HIFYBWMRZGN55AFTYKOBX5AVCNFSM6AAAAABAZBT6WKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRVGMZDMOBYGU . You are receiving this because you authored the thread.Message ID: @.***>

-- A black hole is where God divided by 0.

Enuratique commented 11 months ago

The whole thing is very perplexing why my python wasn't picking it up (I did try importing it from a command line instance of python too and got the same result).

=Eric

On Thu, Dec 21, 2023 at 2:04 PM Eric Medin @.***> wrote:

Thanks, will give it a try and report back.

On Wed, Dec 20, 2023 at 7:51 PM thammo4 @.***> wrote:

The requirement specifications are all set now. I would recommend pip uninstalling uvatradier and then running pip install uvatradier==0.2.2 (or pip3). Then the requirements should appear:

bash-3.2$ pip3 show uvatradier Name: uvatradier Version: 0.2.2 Summary: wahoowah Home-page: https://github.com/thammo4/uvatradier Author: tom hammons Author-email: License: Location: /opt/homebrew/lib/python3.11/site-packages Requires: pandas, requests Required-by: bash-3.2$

— Reply to this email directly, view it on GitHub https://github.com/thammo4/uvatradier/issues/19#issuecomment-1865326885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5KMF2HIFYBWMRZGN55AFTYKOBX5AVCNFSM6AAAAABAZBT6WKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRVGMZDMOBYGU . You are receiving this because you authored the thread.Message ID: @.***>

-- A black hole is where God divided by 0.

-- A black hole is where God divided by 0.

Enuratique commented 11 months ago

OK, I uninstalled and reinstalled. It installed the dependencies as evidenced by the installation output. It shows up when I do pip list as version 0.2.2, however I still get the ModuleNotFoundError.

I asked ChatGPT to give me a python script to iterate through installed modules it can see:

import pkg_resources

# Get a list of installed distributions
installed_distributions = pkg_resources.working_set

# Print information about each installed distribution (module)
for distribution in installed_distributions:
    print(f"Module: {distribution.project_name}, Version: {distribution.version}")

When this code runs, uvatradier does not come back, which would explain why I can't import it... Not sure why pip install isn't doing the correct wiring for it to be "seen" by Python.