Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update installation docs and import methods #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

al626
Copy link

@al626 al626 commented Jul 25, 2016

This isn't so much a pull request as an issue, but seeing as I found a workaround, I thought it would be best to show how I got iprofiler working for me.

Two issues:

  1. I needed to do an npm install to get iprofiler/static/ to appear and allow pip install -e . to work
  2. For some reason, when in IProfilerMagics.iprofile(self, line, cell=None), import iprofiler was importing iprofiler/iprofiler.pyc instead of iprofiler/__init__.pyc, hence the need for the try/except statement.

Thanks for the module!

P.S:
Ubuntu 14.04
IPython 5.0.0
Jupyter 4.1.0
Jupyter notebook 4.2.1
npm 1.3.10
nodejs v0.10.25

@j-towns
Copy link
Owner

j-towns commented Jul 25, 2016

Ah thanks a lot for raising this. I've just replicated both of these issues on my own machine. I think a slightly more efficient way to resolve 1 would be to run python setup.py build before pip install -e .. Note that the setup mechanism for my project is currently based on this 'cookie cutter' project template: https://github.com/jupyter/widget-cookiecutter, and therefore this is an issue with the template. I will open an issue on that repo.

As for 2, I believe this problem only occurs in Python 2 (are you running Python 2?), and is to do with absolute vs relative imports (see here). I think I would like to fix it by putting from __future__ import absolute_import at the top of the file.

Fixed 2: 448eea2

@al626
Copy link
Author

al626 commented Jul 26, 2016

Ah, so that's what absolute_import does. Yeah I was using python2.

Having done some more debugging, I believe that the js building should occur in setup.py:101: check_call(['npm', 'install'], cwd=node_root, stdout=sys.stdout, stderr=sys.stderr)

I've spent some time looking at this and it could be one / a combination of the issues below:

  1. npm does not play well with sudo npm postinstall "npm WARN cannot run in wd" npm/npm#3497

    I was at one point getting errors such as npm WARN cannot run in wd [email protected] webpack (wd=/home/ubuntu/src/iprofiler/js)

  2. Ubuntu / Debian based systems call node nodejs

    I was also getting issues such as:

      sh: 1: webpack: not found
      npm ERR! weird error 127
      npm WARN This failure might be due to the use of legacy binary "node"
      npm WARN For further explanations, please read
      /usr/share/doc/nodejs/README.Debian
    

    My usual fix of sudo ln -s /usr/bin/nodejs /usr/bin/node didn't work

Hopefully this is somewhat helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants