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

No module named cxxfilt when running #649

Open
vadimkantorov opened this issue Dec 11, 2019 · 6 comments
Open

No module named cxxfilt when running #649

vadimkantorov opened this issue Dec 11, 2019 · 6 comments

Comments

@vadimkantorov
Copy link

I installed apex as pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" git+https://github.com/NVIDIA/apex

I'm running python -m apex.pyprof.parse net.sql > net.dict and am getting an error:

  File "/miniconda/lib/python3.7/site-packages/apex/pyprof/parse/__main__.py", line 7, in <module>
    raise e
  File "/miniconda/lib/python3.7/site-packages/apex/pyprof/parse/__main__.py", line 4, in <module>
    from .parse import main
  File "/miniconda/lib/python3.7/site-packages/apex/pyprof/parse/parse.py", line 12, in <module>
    from .kernel import Kernel
  File "/miniconda/lib/python3.7/site-packages/apex/pyprof/parse/kernel.py", line 1, in <module>
    import cxxfilt, struct, binascii
ModuleNotFoundError: No module named 'cxxfilt'

Maybe cxxfilt somewhere not mentioned as dependency and pip doesn't install it?

@ptrblck
Copy link
Collaborator

ptrblck commented Dec 12, 2019

Hi @vadimkantorov,

cxxfilt is already added in requirements.txt.
I'm wondering why it wasn't installed for you.
I'll try to reproduce this issue locally.

@NaleRaphael
Copy link

Hi @vadimkantorov ,
according to the installation command you given, it seems like the installation argument is not given while installing apex: --global-option="--pyprof".
You can try to reinstall apex with this argument again.

@ptrblck
Copy link
Collaborator

ptrblck commented Dec 12, 2019

@NaleRaphael Good catch! :)

@vadimkantorov
Copy link
Author

vadimkantorov commented Dec 17, 2019

Adding --global-option="--pyprof" leads to compilation error (without this option compilation runs successfully). Installation call: pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" --global-option="--pyprof" git+https://github.com/NVIDIA/apex

    /tmp/pip-req-build-d9didphw/setup.py:43: UserWarning: Option --pyprof not specified. Not installing PyProf dependencies!
      warnings.warn("Option --pyprof not specified. Not installing PyProf dependencies!")
  Source in /tmp/pip-req-build-d9didphw has version 0.1, which satisfies requirement apex==0.1 from git+https://github.com/NVIDIA/apex
  Removed apex==0.1 from git+https://github.com/NVIDIA/apex from build tracker '/tmp/pip-req-tracker-2sqckgz2'
Skipping wheel build for apex, due to binaries being disabled for it.
Installing collected packages: apex
  Created temporary directory: /tmp/pip-record-pz2ss3iv
    Running setup.py install for apex: started
    Running command /miniconda/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-d9didphw/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-d9didphw/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --cpp_ext --cuda_ext --pyprof install --record /tmp/pip-record-pz2ss3iv/install-record.txt --single-version-externally-managed --compile
    torch.__version__  =  1.4.0.dev20191217
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-d9didphw/setup.py", line 37, in <module>
        pipmain(["install"] + required_packages)
    TypeError: 'module' object is not callable
    Running setup.py install for apex: finished with status 'error'

Despite --pyprof option, the message warns out: warnings.warn("Option --pyprof not specified. Not installing PyProf dependencies!") - quite stange
`

Full log:
log.txt

Also note strange

pip._internal.exceptions.InstallationError: Command errored out with exit status 1: /miniconda/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-d9didphw/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-d9didphw/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --cpp_ext --cuda_ext --pyprof install --record /tmp/pip-record-pz2ss3iv/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Found index url https://pypi.org/simple
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/pip/ HTTP/1.1" 200 12329
Analyzing links from page https://pypi.org/simple/pip/
  Found link https://files.pythonhosted.org/packages/3d/9d/1e313763bdfb6a48977b65829c6ce2a43eaae29ea2f907c8bbef024a7219/pip-0.2.tar.gz#sha256=88bb8d029e1bf4acd0e04d300104b7440086f94cc1ce1c5c3c31e3293aee1f81 (from https://pypi.org/simple/pip/), version: 0.2
  Found link https://files.pythonhosted.org/packages/18/ad/c0fe6cdfe1643a19ef027c7168572dac6283b80a384ddf21b75b921877da/pip-0.2.1.tar.gz#sha256=83522005c1266cc2de97e65072ff7554ac0f30ad369c3b02ff3a764b962048da (from https://pypi.org/simple/pip/), version: 0.2.1
  Found link https://files.pythonhosted.org/packages/17/05/f66144ef69b436d07f8eeeb28b7f77137f80de4bf60349ec6f0f9509e801/pip-0.3.tar.gz#sha256=183c72455cb7f8860ac1376f8c4f14d7f545aeab8ee7c22cd4caf79f35a2ed47 (from https://pypi.org/simple/pip/), version: 0.3
  Found link https://files.pythonhosted.org/packages/0a/bb/d087c9a1415f8726e683791c0b2943c53f2b76e69f527f2e2b2e9f9e7b5c/pip-0.3.1.tar.gz#sha256=34ce534f17065c78f980702928e988a6b6b2d8a9851aae5f1571a1feb9bb58d8 (from https://pypi.org/simple/pip/), version: 0.3.1
  Found link https://files.pythonhosted.org/packages/cf/c3/153571aaac6cf999f4bb09c019b1ff379b7b599ea833813a41c784eec995/pip-0.4.tar.gz#sha256=28fc67558874f71fddda7168f73595f1650523dce3bc5bf189713ecdfc1e456e (from https://pypi.org/simple/pip/), version: 0.4

many more lines

This happens even if compilation succeeds

@NaleRaphael
Copy link

NaleRaphael commented Dec 17, 2019

Hi @vadimkantorov ,

This message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-req-build-d9didphw/setup.py", line 37, in <module>
    pipmain(["install"] + required_packages)
TypeError: 'module' object is not callable

is probably resulted by the change of pip itself. (see also this commit: pypa/pip@09fd200#diff-cf86c603e352099be697d1bd01c2d191)
In this commit, pip._internal.main became a module. (since pip 19.3)

This issue seems related to #588, #640, and currently going to be fixed by #644, #652.

Before the PR is merged, a quick workaround might be:

  1. clone apex manually, and modify the content:
    # in setup.py, line 5
    from pip._internal import main as pipmain
    # modify line 5 to this
    from pip._internal.main import main as pipmain
  2. run the following command:
    # cd to the root directory of apex
    $ cd apex
    # install by pip
    $ pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" --global-option="--pyprof" ./

If there is any further problem, please feel free to let us know! :)


Besides, the warning message "Option --pyprof not specified. Not installing PyProf dependencies!" is resulted by the first installation command python setup.py egg_info, which is run automatically by pip (and you can see that in log.txt - line 13: Running command python setup.py egg_info). Arguments --cuda_ext --cpp_ext --pyprof are not used at that time, so that warning message is shown. (and it's fine here!)
After the process continues to log.txt - line 31, those three arguments are actually used then. (so that the warning message about --pyprof won't be shown again)

And sorry about the last question of many links of pip, I need to take some time to investigate it.


Update:

About the last question of many links of pip, it does not affect the installation.
The reason why there are so many links of pip is that we run the pip command with these 2 arguments: -v and --no-cache-dir.

In pip._internal.cli.base_command.py:Command._main(), there is a try...except...finally statement, it always run the following code to check whether the version of current used pip is latest or not:

# pip._internal.cli.base_command.py, line 190-191
finally:
    self.handle_pip_version_check(options)

And it continues the following process flow until the check is done:

pip._internal.cli.req_command.py:IndexGroupCommand.handle_pip_version_check()
-> pip._internal.self_outdated_check.py:pip_self_version_check()  # in this function, `options.cache_dir` is `None` (because of the argument `--no-cache-dir`), and it leads `pypi_version` being `None` too.
-> pip._internal.index.py:PackageFinder.find_all_candidates()
-> pip._internal.index.py:PackageFinder.evaluate_links()
-> pip._internal.index.py:PackageFinder.get_install_candidate()
-> pip._internal.index.py:LinkEvaluator.evaluate_link()
-> logger.debug('Found link %s, version: %s', link, version)  # inside of `LinkEvaluator.evaluate_link()`, and that's why we get so many links of `pip` when the argument `-v` is given.

In conclusion, those message can be ignored!

@maggiezha
Copy link

I am learning pyprof: https://github.com/NVIDIA/apex/tree/master/apex/pyprof
I am running NGC Pytorch container 20.01-py3, when I did this step:
2. Run the parse.py script on net.sql to extract kernel and runtime information and save it as net.dict.
python -m apex.pyprof.parse net.sql > net.dict
I also got:
/opt/conda/lib/python3.6/site-packages/apex/pyprof/parse/main.py:6: UserWarning: Did you make sure to install PyProf dependencies by using the --pyprof flag during Apex installation?)
warnings.warn("Did you make sure to install PyProf dependencies by using the --pyprof flag during Apex installation?)")
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/opt/conda/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/conda/lib/python3.6/site-packages/apex/pyprof/parse/main.py", line 7, in
raise e
File "/opt/conda/lib/python3.6/site-packages/apex/pyprof/parse/main.py", line 4, in
from .parse import main
File "/opt/conda/lib/python3.6/site-packages/apex/pyprof/parse/parse.py", line 12, in
from .kernel import Kernel
File "/opt/conda/lib/python3.6/site-packages/apex/pyprof/parse/kernel.py", line 1, in
import cxxfilt, struct, binascii
ModuleNotFoundError: No module named 'cxxfilt'

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

No branches or pull requests

4 participants