-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
UserProxyAgent fails to install packages #239
Comments
It seems that the execution fails while the |
yes - I've tried to get it to work, by changing "use_docker": False to --> "use_docker": True `>>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)... During handling of the above exception, another exception occurred: Traceback (most recent call last): Process finished with exit code 1 is there some extra configuration needed to use docker? |
got it sorted: installing docker for windows (using wsl) works! |
Funny that a project by microsoft does not support windows by default |
Could you please describe in detail the steps to do in windows? |
id also appreciate the steps :) |
same here |
Why is this still not corrected? Autogen? 50% of people use Windows, they try the example, and nothing works |
Hi!
for some reason I'm unable to get this to work:
my code looks like the following:
import autogen
config_list = [
{
'model': 'gpt-4',
'api_key': 'x',
}, # OpenAI API endpoint for gpt-4
{
'model': 'gpt-3.5-turbo',
'api_key': 'x',
}, # OpenAI API endpoint for gpt-3.5-turbo
{
'model': 'gpt-3.5-turbo-16k',
'api_key': 'x',
}, # OpenAI API endpoint for gpt-3.5-turbo-16k
]
create an AssistantAgent named "assistant"
assistant = autogen.AssistantAgent(
name="assistant",
llm_config={
"seed": 42, # seed for caching and reproducibility
"config_list": config_list, # a list of OpenAI API configurations
"temperature": 0, # temperature for sampling
}, # configuration for autogen's enhanced inference API which is compatible with OpenAI API
)
create a UserProxyAgent instance named "user_proxy"
user_proxy = autogen.UserProxyAgent(
name="user_proxy",
human_input_mode="NEVER",
max_consecutive_auto_reply=10,
is_termination_msg=lambda x: x.get("content", "").rstrip().endswith("TERMINATE"),
code_execution_config={
"work_dir": "coding",
"use_docker": False, # set to True or image name like "python:3" to use docker
},
)
the assistant receives a message from the user_proxy, which contains the task description
user_proxy.initiate_chat(
assistant,
message="""What date is today? Compare the year-to-date gain for META and TESLA.""",
)
followup of the previous question
user_proxy.send(
recipient=assistant,
message="""Plot a chart of their stock price change YTD and save to stock_price_ytd.png.""",
)
output is the following:
`C:\autogen\venv2\venv\Scripts\python.exe C:\autogen\venv2\main.py
user_proxy (to assistant):
What date is today? Compare the year-to-date gain for META and TESLA.
assistant (to user_proxy):
First, let's get the current date using Python.
Next, we need to fetch the stock prices for META (Facebook) and TESLA for the current year. We can use the
yfinance
library in Python to fetch this data. Ifyfinance
is not installed, it can be installed using pip:pip install yfinance
.Here is the Python code to fetch the stock prices and calculate the year-to-date gain:
This code will print the year-to-date gain for both META and TESLA.
exitcode: 1 (execution failed)
Code output:
Today's date: 2023-10-14
Traceback (most recent call last):
File "", line 9, in
meta_data = yf.download('FB', start=f'{current_year}-01-01', end=today)
^^^^^
NameError: name 'today' is not defined
SIGALRM is not supported on Windows. No timeout will be enforced.
assistant (to user_proxy):
I apologize for the oversight. The variable
today
was defined in the first code block but not in the second one. Let's correct this by definingtoday
in the second code block as well. Here's the corrected code:This code will print the year-to-date gain for both META and TESLA.
exitcode: 1 (execution failed)
Code output:
1 Failed download:
['FB']: Exception('%ticker%: No timezone found, symbol may be delisted')
:14: FutureWarning: Series.getitem treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use
ser.iloc[pos]
meta_ytd_gain = ((meta_data['Close'][-1] - meta_data['Close'][0]) / meta_data['Close'][0]) * 100
Traceback (most recent call last):
File "", line 14, in
meta_ytd_gain = ((meta_data['Close'][-1] - meta_data['Close'][0]) / meta_data['Close'][0]) * 100
~~~~~~~~~~~~~~~~~~^^^^
File "C:\autogen\venv2\venv\Lib\site-packages\pandas\core\series.py", line 1037, in getitem
return self._values[key]
~~~~~~~~~~~~^^^^^
IndexError: index -1 is out of bounds for axis 0 with size 0
SIGALRM is not supported on Windows. No timeout will be enforced.
assistant (to user_proxy):
I apologize for the confusion. The ticker symbol for Meta Platforms (formerly Facebook) has changed from 'FB' to 'META'. Let's correct this in the code:
This code will print the year-to-date gain for both META and TESLA.
exitcode: 0 (execution succeeded)
Code output:
[100%%*] 1 of 1 completed
[100%%*] 1 of 1 completed
META year-to-date gain: 152.27674188762134%
TESLA year-to-date gain: 132.3034215188311%
assistant (to user_proxy):
Great! The code executed successfully.
As of today (October 14, 2023), the year-to-date gain for META is approximately 152.28%, and for TESLA, it's approximately 132.30%.
This means that if you had invested in these stocks at the beginning of the year, your investment in META would have increased by about 152.28% and in TESLA by about 132.30%.
Please note that stock prices are subject to market fluctuations and the values provided are based on the closing prices of the stocks on the given date.
TERMINATE
user_proxy (to assistant):
Plot a chart of their stock price change YTD and save to stock_price_ytd.png.
SIGALRM is not supported on Windows. No timeout will be enforced.
assistant (to user_proxy):
Sure, we can use the matplotlib library in Python to plot the stock price changes for META and TESLA. If matplotlib is not installed, it can be installed using pip:
pip install matplotlib
.Here is the Python code to plot the stock prices and save the plot to a file:
This code will create a line plot of the closing prices of META and TESLA stocks from the start of the year to today, and save the plot to a file named 'stock_price_ytd.png'.
exitcode: 1 (execution failed)
Code output:
Traceback (most recent call last):
File "", line 2, in
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
assistant (to user_proxy):
I apologize for the oversight. It seems that the matplotlib library is not installed in your Python environment. You can install it using pip, which is a package manager for Python. Here is the command to install matplotlib:
# shell script pip install matplotlib
After installing matplotlib, you can run the previous Python code to plot the stock prices and save the plot to a file.
Process finished with exit code 1
so every time when the userproxyagent tries to install the "matplotlib" it crashes - when I install it manually and run the script again, it creates the png file as it should
am I doing something wrong here? probably ^_^
thanks
The text was updated successfully, but these errors were encountered: