jorisvandenbossche commented on PR #49912:
URL: https://github.com/apache/arrow/pull/49912#issuecomment-4371838548

   Hmm, that's annoying. 
   
   I don't directly understand why this is failing, though (but I can reproduce 
it by setting `sys.modules['pyarrow'] = None` first and then important pandas 
locally). In pandas, in cython code, we essentially do 
[this](https://github.com/pandas-dev/pandas/blob/b00d4f6710ff6c1c80319196657c31c2cf6c70ff/pandas/_libs/lib.pyx#L130-L137):
   
   ```
   cdef bint PYARROW_INSTALLED = False
   
   try:
       import pyarrow as pa
   
       PYARROW_INSTALLED = True
   except ImportError:
       pa = None
   
   ```
   
   Trying to import pyarrow after `sys.modules['pyarrow'] = None` does raise a 
`ModuleNotFoundError`, which is a subclass of `ImportError`, and so I think 
should be correctly caught by the block above? 
   Unless that code does not behave exactly as expected when in cython.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to