victoriadrake / chatgptmax

Python module to send large input to ChatGPT using preprocessing and chunking.
MIT License
16 stars 1 forks source link

Installing with pip in venv: missing code directory #10

Open liammcdermott opened 10 months ago

liammcdermott commented 10 months ago

Thank you very much for making this module. I was about 25% of the way through (badly) implementing something like it myself, so you've saved me from that!

Describe the bug I'm not sure if this is venv-related, however, creating a venv then pip install-ing this module seems to result in no code files being downloaded.

After using pip to install chatgptmax in a venv, it seems there is a chatgptmax directory missing. Sample of my env/lib/python3.11/site-packages:

[...]
drwxrwxr-x  4 liam liam 4096 Oct 11 00:23 charset_normalizer/
drwxrwxr-x  2 liam liam 4096 Oct 11 00:23 charset_normalizer-3.3.0.dist-info/
drwxrwxr-x  2 liam liam 4096 Oct 11 00:30 chatgptmax-1.0.2.dist-info/
drwxrwxr-x  3 liam liam 4096 Oct 11 00:08 _distutils_hack/
-rw-rw-r--  1 liam liam  151 Oct 11 00:08 distutils-precedence.pth
drwxrwxr-x  3 liam liam 4096 Oct 11 00:23 frozenlist/
drwxrwxr-x  2 liam liam 4096 Oct 11 00:23 frozenlist-1.4.0.dist-info/
[...]

And we can see venv pip (as opposed to global) is used, and completes with no errors or warnings:

(env) liam@liam-XPS-13-9370:~/code/port$ pip install chatgptmax -vvv
Using pip 23.0.1 from /home/liam/code/port/env/lib/python3.11/site-packages/pip (python 3.11)
Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-build-tracker-_wtu6yso
Initialized build tracking at /tmp/pip-build-tracker-_wtu6yso
Created build tracker: /tmp/pip-build-tracker-_wtu6yso
Entered build tracker: /tmp/pip-build-tracker-_wtu6yso
Created temporary directory: /tmp/pip-install-8unq0kcv
Created temporary directory: /tmp/pip-ephem-wheel-cache-xj488fik
Requirement already satisfied: chatgptmax in ./env/lib/python3.11/site-packages (1.0.2)
Requirement already satisfied: openai in ./env/lib/python3.11/site-packages (from chatgptmax) (0.28.1)
Requirement already satisfied: tiktoken in ./env/lib/python3.11/site-packages (from chatgptmax) (0.5.1)
Requirement already satisfied: requests>=2.20 in ./env/lib/python3.11/site-packages (from openai->chatgptmax) (2.31.0)
Requirement already satisfied: tqdm in ./env/lib/python3.11/site-packages (from openai->chatgptmax) (4.66.1)
Requirement already satisfied: aiohttp in ./env/lib/python3.11/site-packages (from openai->chatgptmax) (3.8.6)
Requirement already satisfied: regex>=2022.1.18 in ./env/lib/python3.11/site-packages (from tiktoken->chatgptmax) (2023.10.3)
Requirement already satisfied: charset-normalizer<4,>=2 in ./env/lib/python3.11/site-packages (from requests>=2.20->openai->chatgptmax) (3.3.0)
Requirement already satisfied: idna<4,>=2.5 in ./env/lib/python3.11/site-packages (from requests>=2.20->openai->chatgptmax) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./env/lib/python3.11/site-packages (from requests>=2.20->openai->chatgptmax) (2.0.6)
Requirement already satisfied: certifi>=2017.4.17 in ./env/lib/python3.11/site-packages (from requests>=2.20->openai->chatgptmax) (2023.7.22)
Requirement already satisfied: attrs>=17.3.0 in ./env/lib/python3.11/site-packages (from aiohttp->openai->chatgptmax) (23.1.0)
Requirement already satisfied: multidict<7.0,>=4.5 in ./env/lib/python3.11/site-packages (from aiohttp->openai->chatgptmax) (6.0.4)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in ./env/lib/python3.11/site-packages (from aiohttp->openai->chatgptmax) (4.0.3)
Requirement already satisfied: yarl<2.0,>=1.0 in ./env/lib/python3.11/site-packages (from aiohttp->openai->chatgptmax) (1.9.2)
Requirement already satisfied: frozenlist>=1.1.1 in ./env/lib/python3.11/site-packages (from aiohttp->openai->chatgptmax) (1.4.0)
Requirement already satisfied: aiosignal>=1.1.2 in ./env/lib/python3.11/site-packages (from aiohttp->openai->chatgptmax) (1.3.1)
Created temporary directory: /tmp/pip-unpack-o712ge1p
Removed build tracker: '/tmp/pip-build-tracker-_wtu6yso'

But, running import chatgptmax results in a ModuleNotFound error:

(env) liam@liam-XPS-13-9370:~/code/port/env/lib/python3.11/site-packages$ python
Python 3.11.4 (main, Jun  9 2023, 07:59:55) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import chatgptmax
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'chatgptmax'
>>> import tiktoken
>>> tiktoken.
tiktoken.Encoding(                 tiktoken.encoding_for_model(       tiktoken.get_encoding(             tiktoken.model
tiktoken.core                      tiktoken.encoding_name_for_model(  tiktoken.list_encoding_names()     tiktoken.registry
>>> tiktoken.list_encoding_names()
['gpt2', 'r50k_base', 'p50k_base', 'p50k_edit', 'cl100k_base']
>>> 

I don't think it's my environment, since tiktoken works.

To Reproduce Steps to reproduce the behaviour:

  1. `python3 -m venv env
  2. source env/bin/activate
  3. pip install chatgptmax -vvv
  4. python
  5. >>> import chatgptmax

Expected behavior >>> import chatgptmax should import the module's code, rather than

Desktop (please complete the following information):

liammcdermott commented 10 months ago

Just a guess, but could this be related to this action failing: https://github.com/victoriadrake/chatgptmax/actions/runs/6316522866 ?

victoriadrake commented 10 months ago

Thank you for bringing this to my attention!

I've cleared the error for that action. Could you try with the latest version (1.0.3)? You can do pip install -U chatgptmax~=1.0.3

liammcdermott commented 10 months ago

Thank you for bringing this to my attention!

You're very welcome! I hope you can figure out this packaging issue!

I tried pip install -U chatgptmax~=1.0.3, sadly the result was the same: no code files downloaded, only some metadata.

victoriadrake commented 9 months ago

Thanks for giving it another try! I can't replicate this error in the latest version, could you give it another try?