AbanteAI / rawdog

Generate and auto-execute Python scripts in the cli
Apache License 2.0
1.79k stars 140 forks source link

I get this error on Windows 10 "AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'?" #39

Closed jonatj closed 9 months ago

jonatj commented 9 months ago

I've successfully installed and used 'rawdog' on my personal workstation at home. But when I installed and ran it on my corporate workstation I get the error:

AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'?

My quick google suggests that this has to do with Windows not using the 'os.uname' method but instead should use 'platform.name'.

Is there a way to make sure 'rawdog' is using the Windows method?

Thanks in advanced!

jonatj commented 9 months ago

I should point out that i also got this error first:

ModuleNotFoundError: No module named 'readline'

But this error was fixed by:

pip install pyreadline

biobootloader commented 9 months ago

Just merged a fix! https://github.com/AbanteAI/rawdog/pull/40

Let me know if that works for you. If you installed with pip it's not updated there yet - if you clone the repo you could test it

jonatj commented 9 months ago

Cool! Thank you! I'll give this a try.

jonatj commented 9 months ago

I'm sorry to ask. How do I run 'rawdog' after I've cloned the repo? There's no executable in the folders.

jakethekoenig commented 9 months ago

pip install -e . (you may want to do this in a venv). Then you should be able to run rawdog.

jonatj commented 9 months ago

Thanks for that. I ran the pip install -e . in the git cloned folder and it installed without issue. But I still get this error:

(venv) PS C:\Temp\rawdog> rawdog How many files are in this directory? C:\Temp\rawdog\src\rawdog__main.py:64: SyntaxWarning: invalid escape sequence '_' /___/ U Rawdog v{version}""" Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Temp\venv\Scripts\rawdog.exe__main.py", line 4, in File "C:\Temp\rawdog\src\rawdog\main__.py", line 5, in import readline ModuleNotFoundError: No module named 'readline'

biobootloader commented 9 months ago

ah, seems readline is a python module that's not available on windows.

You fixed it before with pip install pyreadline, does that work? I'll look into options to make this work for everyone

jonatj commented 9 months ago

Okay, I made some progress. I installed the pyreadline3 (need the version 3):

pip install --trusted-host pythonhosted.org --trusted-host files.pythonhosted.org pyreadline3

Then I saw another error with 'pkg_resources':

(venv) PS C:\Temp\rawdog> pip install --trusted-host pythonhosted.org --trusted-host files.pythonhosted.org pyreadline3 Collecting pyreadline3 Using cached pyreadline3-3.4.1-py3-none-any.whl (95 kB) Installing collected packages: pyreadline3 Successfully installed pyreadline3-3.4.1 (venv) PS C:\Temp\rawdog> rawdog How many files are in this directory? Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Temp\venv\Scripts\rawdog.exe__main.py", line 4, in File "C:\Temp\rawdog\src\rawdog__main__.py", line 9, in from rawdog.llm_client import LLMClient File "C:\Temp\rawdog\src\rawdog\llm_client.py", line 9, in from litellm import completion, completion_cost File "C:\Temp\venv\Lib\site-packages\litellm\init__.py", line 520, in from .utils import ( File "C:\Temp\venv\Lib\site-packages\litellm\utils.py", line 32, in import pkg_resources ModuleNotFoundError: No module named 'pkg_resources'

The 'pkg_resources' is in setuptools, so I:

pip install --trusted-host pythonhosted.org --trusted-host files.pythonhosted.org setuptools wheel

Then when I run rawdog. It actually starts kind of. But I get a huge wall of error text and at the bottom saying "

"openai.APIConnectionError: Connection error."

The wall of error messages shows a lot of self-signed certificate errors and SSL: CERTIFICATE_VERIFY_FAILED messages.

So I think my current problem is due to our firewall acting as man-in-the-middle with our corporate certs. There is some troubleshooting I found related to it, but it will take awhile to figure out what to do. There is a way to disable Python cert verification, that's why I was using the --trusted-host flags when installing. But now that rawdog is reaching out to OpenAI, I have no way of 'trusting' that URL.

kvaky commented 9 months ago

ah, seems readline is a python module that's not available on windows.

You fixed it before with pip install pyreadline, does that work? I'll look into options to make this work for everyone

@biobootloader requirements.txt: pyreadline3==3.4.1; platform_system == "Windows"

But can't test it myself as I'm on mac

biobootloader commented 9 months ago

Thanks @kvaky , I can't test on Windows either but I've just added: https://github.com/AbanteAI/rawdog/pull/46

biobootloader commented 9 months ago

@jonatj does it work when you're not on the corporate firewall?

jonatj commented 9 months ago

Yes, it works perfectly on my home computer (Windows 11). So I know it’s just our corporate network affected this. I also don’t have administrator rights on my work computer, but I’m not sure that is related. I’m really bummed because I love the functionality of Rawdog and wanted everyone to use it on my team. On Feb 8, 2024, at 12:03 PM, biobootloader @.***> wrote: @jonatj does it work when you're not on the corporate firewall?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

man-im-unoriginal-af commented 9 months ago

I've successfully installed and used 'rawdog' on my personal workstation at home. But when I installed and ran it on my corporate workstation I get the error:

AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'?

My quick google suggests that this has to do with Windows not using the 'os.uname' method but instead should use 'platform.name'.

Is there a way to make sure 'rawdog' is using the Windows method?

Thanks in advanced!

Being a Windows-exclusive error, host = os.uname()[1]

had to be changed to: host = os.name

That's the fix.