nsetzer / mpgameserver

Python Multiplayer UDP Game Server
GNU Lesser General Public License v2.1
43 stars 6 forks source link

cryptography.hazmat.backends.openssl.ec - Attempting to try echo demo #12

Open hutchins opened 1 month ago

hutchins commented 1 month ago

I'm attempting to get your echo demo to run. I've installed mpgameserver 0.2.3 via pip. Could you provide a requirements.txt or steps for a clean virtualenv or other workaround?

% python3.11 echoclient.py
Traceback (most recent call last):
  File "/Users/hutchins/projects/game/echo/echoclient.py", line 1, in <module>
    from mpgameserver import UdpClient, Timer
  File "/opt/homebrew/lib/python3.11/site-packages/mpgameserver/__init__.py", line 5, in <module>
    from mpgameserver.client import UdpClient
  File "/opt/homebrew/lib/python3.11/site-packages/mpgameserver/client.py", line 12, in <module>
    from .connection import ClientServerConnection, Packet, PacketHeader, \
  File "/opt/homebrew/lib/python3.11/site-packages/mpgameserver/connection.py", line 71, in <module>
    from . import crypto
  File "/opt/homebrew/lib/python3.11/site-packages/mpgameserver/crypto.py", line 70, in <module>
    from cryptography.hazmat.backends.openssl.ec import _EllipticCurvePublicKey, _EllipticCurvePrivateKey
ModuleNotFoundError: No module named 'cryptography.hazmat.backends.openssl.ec'
timromney commented 1 month ago

I believe this is a duplicate issue. Check https://github.com/nsetzer/mpgameserver/issues/7 Also, downgrading a little does seem to work as mentioned. I believe if you use an earlier version of pygame it will work as well. I used to mess around with it, but forgot the specific versions that work.

If you're still stuck later, I can find the exact versions that work. It really just took digging a bit to see when cryptography.hazmat.backends.openssl.ec was deprecated in the OpenSSL package, and choosing that version.

nick-setzer-simplisafe commented 1 month ago

Thanks for the info. I just ran a test with the version in the repo. I think I just need to push an update to pypi. I noticed the pinned versions in the pyproject.toml haven't been updated in a while, so I went ahead and upgraded everything to the latest.

let me know If you can use the version in main branch, and Ill go ahead and push a new update to pypi tomorrow

$pip freeze
cryptography==42.0.7
Pillow==9.5.0
pygame==2.5.2
pyOpenSSL==24.1.0
service-identity==24.1.0
Twisted==24.3.0
urllib3==2.0.4

$ ls demo/echo*
demo/echoclient.py  demo/echoserver.py

# in the first terminal
$ python -m demo.echoserver

# in the second terminal
$ python -m demo.echoclient