Open Broever101 opened 2 years ago
THis fine person submitted a PR that looks like it fixes the issue. Try this branch: https://github.com/ennnas/pyserum/tree/chore/upgrade_solanapy
THis fine person submitted a PR that looks like it fixes the issue. Try this branch: https://github.com/ennnas/pyserum/tree/chore/upgrade_solanapy
Seems to fix that error but this:
(env) dave-ThinkPad:~/tmp$ python list1.py
Traceback (most recent call last):
File "list1.py", line 8, in <module>
market = Market.load(cc, market_address)
File "tmp/env/lib/python3.8/site-packages/pyserum-0.5.0a0-py3.8.egg/pyserum/market/market.py", line 56, in load
market_state = MarketState.load(conn, market_address, program_id)
File "tmp/env/lib/python3.8/site-packages/pyserum-0.5.0a0-py3.8.egg/pyserum/market/state.py", line 41, in load
bytes_data = utils.load_bytes_data(market_address, conn)
File "tmp/env/lib/python3.8/site-packages/pyserum-0.5.0a0-py3.8.egg/pyserum/utils.py", line 17, in load_bytes_data
res = conn.get_account_info(addr)
File "tmp/env/lib/python3.8/site-packages/solana-0.28.1-py3.8.egg/solana/rpc/api.py", line 180, in get_account_info
body = self._get_account_info_body(
File "tmp/env/lib/python3.8/site-packages/solana-0.28.1-py3.8.egg/solana/rpc/core.py", line 185, in _get_account_info_body
return GetAccountInfo(pubkey.to_solders(), config)
AttributeError: 'str' object has no attribute 'to_solders'
:-(
I have my own fork now, I plan to add support for other DEXes.
https://github.com/pbharrin/py_no_broker
There is example code here, showing the current orderbook for Openbook: https://github.com/pbharrin/py_no_broker/blob/alpha/examples/show_orderbook.py
All you should need is to install solana and requests.
pip install solana
pip install requests
Great! I'll try it.
Btw, in the past hours I made some of the branches of this repo work (those failing because of missing RPCResponse) by hardcoding the solana version to this:
solana==0.20.0
maybe this may help someone.... and.. as because this is actually what this ticket was about...
While running the example code:
from pyserum.connection import get_live_markets, get_token_mints print("tokens: ") print(get_token_mints()) print("markets: ") print(get_live_markets())
The error:
ImportError Traceback (most recent call last) [<ipython-input-2-3233e15d8b3e>](https://localhost:8080/#) in <module> ----> 1 from pyserum.connection import get_live_markets, get_token_mints 2 print("tokens: ") 3 print(get_token_mints()) 4 print("markets: ") 5 print(get_live_markets()) 2 frames [/usr/local/lib/python3.7/dist-packages/pyserum/market/market.py](https://localhost:8080/#) in <module> 7 from solana.publickey import PublicKey 8 from solana.rpc.api import Client ----> 9 from solana.rpc.types import RPCResponse, TxOpts 10 from solana.transaction import Transaction 11 ImportError: cannot import name 'RPCResponse' from 'solana.rpc.types' (/usr/local/lib/python3.7/dist-packages/solana/rpc/types.py)
Checking out the latest
solana.rpc.types
, there really is noRPCResponse
. https://github.com/michaelhly/solana-py/blob/master/src/solana/rpc/types.pyAny pointers/fixes?
@Broever101 yes, setup for example solana dependency to version 0.20.0 :
pip uninstall solana
) and then install again but fixing the version to 0.20.0 (with: pip install solana==0.20.0
) That worked for me.
While running the example code:
from pyserum.connection import get_live_markets, get_token_mints print("tokens: ") print(get_token_mints()) print("markets: ") print(get_live_markets())
The error:
ImportError Traceback (most recent call last) [<ipython-input-2-3233e15d8b3e>](https://localhost:8080/#) in <module> ----> 1 from pyserum.connection import get_live_markets, get_token_mints 2 print("tokens: ") 3 print(get_token_mints()) 4 print("markets: ") 5 print(get_live_markets()) 2 frames [/usr/local/lib/python3.7/dist-packages/pyserum/market/market.py](https://localhost:8080/#) in <module> 7 from solana.publickey import PublicKey 8 from solana.rpc.api import Client ----> 9 from solana.rpc.types import RPCResponse, TxOpts 10 from solana.transaction import Transaction 11 ImportError: cannot import name 'RPCResponse' from 'solana.rpc.types' (/usr/local/lib/python3.7/dist-packages/solana/rpc/types.py)
Checking out the latest
solana.rpc.types
, there really is noRPCResponse
. https://github.com/michaelhly/solana-py/blob/master/src/solana/rpc/types.py Any pointers/fixes?@Broever101 yes, setup for example solana dependency to version 0.20.0 :
- One way: you can try, after installing dependencies to uninstall solana package (
pip uninstall solana
) and then install again but fixing the version to 0.20.0 (with:pip install solana==0.20.0
)- Other way could be before installing everything setup requirements.txt to have solana using the mentioned version and proceed to install.
That worked for me.
Yes, actually I got it to work a long time ago by using the hardcoded version. Forgot to update here, but thanks for the update! It'll be helpful to anyone coming along later.
Hello Please help me. ImportError: cannot import name 'RPCResponse' from 'solana.rpc.types' I am using Python 3.12.3 now.
While running the example code:
The error:
Checking out the latest
solana.rpc.types
, there really is noRPCResponse
. https://github.com/michaelhly/solana-py/blob/master/src/solana/rpc/types.pyAny pointers/fixes?