Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by Wilson Edwards
at 2025-02-07 00:06:18
Point:500 Replies:6 POST_ID:829297USER_ID:12108
Topic:
python3;centos;deepseek
Could not install ollama from python3 install ollama...so try alternative ,using python3 install openai , but easy example python script still not working, , the error is such as AttributeError: module 'ollama' has no attribute 'chat'
import ollam //or improt openairesponse = ollama.chat(model="deepseek-r1", messages=[ { "role":"user", "content":"how center a tag in a div tag by javascript" },])print(response["message"]["content"])
OR next example:
import os
import openai
openai.api_key = ("key")
openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(completion.choices[0].message)
// Error AttributeError: module 'ollama' has no attribute 'ChatCompletion'
if use comand line ollama, it works
> ollama server //need enable port 127.0.0.1:11434
> ollam run deepseek-r1
>>>>"chat"
Any Advise ?
Try to list all module :
print(dir(ollama))
//No any moduel name, chat...
Error: Command '['/home/..../venv/bin/python3.x', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
Reference:
Author: Wilson Edwards replied at 2025-02-10 21:42:38
Useful command:
curl -X GET "https://api.example.com/data" | ollama run llama3.2 "Analyze the following API data and summarize key insights."chmod +x your.sh
Author: Wilson Edwards replied at 2025-02-10 20:28:26
ollama tutorial
Accepted Solution
Author: Wilson Edwards replied at 2025-02-05 15:06:33
500 points Excellent
download ollama-python zip file athttps://github.com/ollama/ollama-python
python39 -m pip install ollama-python-main.zip
if u get error ,python39 -m pip install ollama, error, ModuleNotFoundError: No module named '_sysconfigdata__linux_x86_64-linux-gnu'
u may be system version issue, reinstall it python39 using make altinstall that not affect curent version of python3.6. or Using Virtual env...to install
To list all your python3.9 module:
python39 -m pip list
make link to python39, ln -sfn /home/yourdir/Python3.9/python / /usr/bin/python39
if ok, start to install ollama as article below, then, enable port 11434
#>ollama serve
open new console
#>python39 yourscript //as follows
import ollamaprint("start")response=ollama.chat( model="deepseek-r1", messages=[ {"role": "user", "content": "Tell me 5 cyber security good practices"}, ])print("waiting...")print(response["message"]["content"])
it will show output in 2-minute;
Try to speed this ,Installing CUDA on WSL thennvidia-smi
Reference: