Skip to content

Commit

Permalink
Merge pull request #1993 from minrk/improve-cython-msg
Browse files Browse the repository at this point in the history
improve detail in uncompiled Cython import message
  • Loading branch information
minrk authored May 25, 2024
2 parents 0e5615f + de2c1c0 commit afe4248
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion zmq/backend/cython/_zmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,25 @@
if not cython.compiled:
raise ImportError()
except ImportError:
raise ImportError("zmq Cython backend has not been compiled") from None
from pathlib import Path

zmq_root = Path(__file__).parents[3]
msg = f"""
Attempting to import zmq Cython backend, which has not been compiled.
This probably means you are importing zmq from its source tree.
if this is what you want, make sure to do an in-place build first:
pip install -e '{zmq_root}'
If it is not, then '{zmq_root}' is probably on your sys.path,
when it shouldn't be. Is that your current working directory?
If neither of those is true and this file is actually installed,
something seems to have gone wrong with the install!
Please report at https://github.com/zeromq/pyzmq/issues
"""
raise ImportError(msg)

import time
import warnings
Expand Down

0 comments on commit afe4248

Please sign in to comment.