ImportError: Start directory is not importable: 'ipython'

Issue #169 resolved
Laurent Gautier
created an issue

Current tip for the branch version_2.4.x is failing tests with:

ImportError: Start directory is not importable: 'ipython'

This might originate from the following error when trying to import rpy2.ipython:

.../site-packages/rpy2/ipython/rmagic.py", line 73, in <module>
    from IPython.utils.py3compat import (str_to_unicode, unicode_to_str, PY3,
ImportError: cannot import name unicode_type

Comments (10)

  1. Pablo Oliveira

    Your last build https://drone.io/bitbucket.org/lgautier/rpy2/6 shows the following message:

    $ python -m rpy2.tests
    rpy2 version: 2.4.0
    - built against R version: 2-14.1--57956
    - running linked to R version: R version 2.14.1 (2011-12-22)
    Error in loadNamespace(name) : there is no package called ‘ggplot2’
    Traceback (most recent call last):
      [...]
      File "/home/ubuntu/src/bitbucket.org/lgautier/rpy2/build-2.7/rpy2/tests.py", line 28, in faster_load_tests
        suite_ipython = loader.discover('ipython', pattern, rpy_root)
      File "/usr/lib/python2.7/unittest/loader.py", line 202, in discover
        raise ImportError('Start directory is not importable: %r' % start_dir)
    ImportError: Start directory is not importable: 'ipython'
    

    The ipython module loads the gpplot2 package which cannot be found on the drone.io build bot. This seems to be the new problem.

    Tests pass on https://drone.io/bitbucket.org/pablooliveira/rpy2/28 by installing ggplot2 on the drone.io environment.

    The new configuration is available in PR 20 (https://bitbucket.org/lgautier/rpy2/pull-request/20/).

  2. Allan Campopiano

    Hi Laurent,

    Trying to resolve some other issues and I thought I'd run the rpy2 tests to see if it turned up anything. This is what I got, which appears similar to this thread.

    (test_env) allan@allan-OptiPlex-7010:~$ python -m rpy2.tests
    rpy2 version: 2.9.1
    - built against R version: 3-5.1--74947
    - running linked to R version: R version 3.5.1 (2018-07-02)
    /home/allan/anaconda3/envs/test_env/lib/python3.7/site-packages/rpy2/robjects/lib/dplyr.py:24: UserWarning: This was designed againt dplyr version 0.7.4 but you have 0.7.6
      warnings.warn('This was designed againt dplyr version %s but you have %s' % (TARGET_VERSION, dplyr.__version__))
    /home/allan/anaconda3/envs/test_env/lib/python3.7/site-packages/rpy2/robjects/lib/ggplot2.py:67: UserWarning: This was designed againt ggplot2 version 2.2.1 but you have 3.0.0
      warnings.warn('This was designed againt ggplot2 version %s but you have %s' % (TARGET_VERSION, ggplot2.__version__))
    E
    ======================================================================
    ERROR: __main__ (unittest.loader._FailedTest)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/allan/anaconda3/envs/test_env/lib/python3.7/site-packages/rpy2/tests.py", line 57, in load_tests
        suite_ipython= loader.discover('ipython', pattern, rpy_root)
      File "/home/allan/anaconda3/envs/test_env/lib/python3.7/unittest/loader.py", line 344, in discover
        raise ImportError('Start directory is not importable: %r' % start_dir)
    ImportError: Start directory is not importable: 'ipython'
    

    Could this be this be related to the LookupError: 'show' not found issue?

    Sincerely, Al

  3. Cindy Darnell

    Hi Laurent, I'm also getting the same ipython error above when I try to install with conda (2.9.4). I saw your comment above and tried to install using pip (2.9.5) but I'm getting a different error now:

    Darnkrevelen:~ CDarnell$ pip install rpy2
    Collecting rpy2
      Using cached https://files.pythonhosted.org/packages/02/d1/074ffbbe7b4bf74c60b75d74c8e67a1e4515b0d85f85cd6540e39610754a/rpy2-2.9.5.tar.gz
        Complete output from command python setup.py egg_info:
        R version 3.5.1 (2018-07-02) -- "Feather Spray"
        /Users/CDarnell/miniconda3/lib/R/bin/R CMD config --ldflags
        /Users/CDarnell/miniconda3/lib/R/bin/R CMD config --cppflags
        usage: -c [-h] [-I I] [-L L] [-l L]
        -c: error: argument -h/--help: ignored explicit argument 'eaderpad_max_install_names'
    
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 2 in /private/var/folders/xk/gknpffhs6sx0fm4fsncp9ys00000gn/T/pip-install-ww75braj/rpy2/
    

    The 'eaderpad_max_install_names' suggests there's a missing 'h' somewhere in some code, but I cannot find it. I'm also not savvy enough to track it down with the error info given above.

    Cheers, Cindy

  4. Laurent Gautier reporter

    Hi, Whenever conda pops up anywhere in an issue report and I am pointing the unfortunate user toward conda support channels. I don't think that the string eaderpad_max_install_names is anywhere in the rpy2 source code.

  5. Jurgen Heymann

    Hi Laurent,

    I have the same problem as Pablo Oliveira. In my case: macOSx10.13 High Sierra python3.7 (Homebrew install) R3.5.2(via:(https://www.r-project.org/)) pip3 install rpy2 #(which is 2.9.5) iPython is installed Here is the output:

    admins-iMac-2:rpy2-2.9.5 admin$ python3 -m 'rpy2.tests' rpy2 version: 2.9.5 - built against R version: 3-5.1--74947 - running linked to R version: R version 3.5.2 (2018-12-20) /usr/local/lib/python3.7/site-packages/rpy2/robjects/lib/dplyr.py:24: UserWarning: This was designed againt dplyr version 0.7.5 but you have 0.8.0.1 warnings.warn('This was designed againt dplyr version %s but you have %s' % (TARGET_VERSION, dplyr.version)) /usr/local/lib/python3.7/site-packages/rpy2/rinterface/init.py:146: RRuntimeWarning: Error in loadNamespace(name) : there is no package called ‘RSQLite’

    warnings.warn(x, RRuntimeWarning) /usr/local/lib/python3.7/site-packages/rpy2/rinterface/init.py:146: RRuntimeWarning: In addition: warnings.warn(x, RRuntimeWarning) /usr/local/lib/python3.7/site-packages/rpy2/rinterface/init.py:146: RRuntimeWarning: Warning message:

    warnings.warn(x, RRuntimeWarning) /usr/local/lib/python3.7/site-packages/rpy2/rinterface/init.py:146: RRuntimeWarning: In formals(fun) : warnings.warn(x, RRuntimeWarning) /usr/local/lib/python3.7/site-packages/rpy2/rinterface/init.py:146: RRuntimeWarning: argument is not a function

    warnings.warn(x, RRuntimeWarning) /usr/local/lib/python3.7/site-packages/rpy2/robjects/lib/ggplot2.py:67: UserWarning: This was designed againt ggplot2 version 2.2.1 but you have 3.1.0 warnings.warn('This was designed againt ggplot2 version %s but you have %s' % (TARGET_VERSION, ggplot2.version)) E ====================================================================== ERROR: main (unittest.loader._FailedTest)


    Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/rpy2/tests.py", line 57, in load_tests suite_ipython= loader.discover('ipython', pattern, rpy_root) File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/loader.py", line 344, in discover raise ImportError('Start directory is not importable: %r' % start_dir) ImportError: Start directory is not importable: 'ipython'

    How can I fix this?

    Jurgen

  6. Log in to comment