ghpythonremote icon indicating copy to clipboard operation
ghpythonremote copied to clipboard

Runtime error (ImportException): No module named ghpythonremote

Open Supermonkey-design opened this issue 2 years ago • 6 comments

Hi @pilcru! Sorry to bother you, but i seem to be stuck at the installation step and really would like to try this amazing plugin. I've followed meticulously the installation guide, but i'm also very new to all of this so i may do miss something easy. Basically i've installed Anaconda3 (selecting "Add conda to my PATH"), created the env rhinoremote, activated it and run the provided commands. Problems seem to happen when running the ghpyr configure ironpython installation: i've tried running the general one and the one with a specific folder, but this is what shows (in the conda prompt, win cmd prompt or powershell)

(rhinoremote) C:\Users\PREDATOR>conda env list
# conda environments:
#
base                     C:\Users\PREDATOR\anaconda3
rhinoremote           *  C:\Users\PREDATOR\anaconda3\envs\rhinoremote


(rhinoremote) C:\Users\PREDATOR>python -m ghpythonremote._configure_ironpython_installation ^
Ancora? "%APPDATA%\McNeel\Rhinoceros\7.0\Plug-ins\^
Ancora? IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib"
The gh-python-remote package will be installed in Rhino IronPython with the command:
C:\Users\PREDATOR\anaconda3\envs\rhinoremote\python.exe -m pip install --upgrade --target=C:\Users\PREDATOR\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib --no-compile --ignore-requires-python gh-python-remote
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting gh-python-remote
  Using cached https://files.pythonhosted.org/packages/0b/15/757df4424310efdfff9ed0fc314a613ef76d085067ab7666be90b3895556/gh_python_remote-1.4.4-py2-none-any.whl
Collecting rpyc==4.1.5
  Using cached https://files.pythonhosted.org/packages/36/a7/7898de583e17202ce02ac7ecffdbed95c72a6cebe468c1ee6fc94fc20933/rpyc-4.1.5-py2-none-any.whl
Collecting plumbum
  Using cached https://files.pythonhosted.org/packages/5f/c9/67b40a607f9815275c7867f9ec60700f442c186d3cca235156cb4fa19c33/plumbum-1.8.0.tar.gz
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\cli\base_command.py", line 153, in _main
    status = self.run(options, args)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\commands\install.py", line 382, in run
    resolver.resolve(requirement_set)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\legacy_resolve.py", line 201, in resolve
    self._resolve_one(requirement_set, req)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\legacy_resolve.py", line 365, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\legacy_resolve.py", line 313, in _get_abstract_dist_for
    req, self.session, self.finder, self.require_hashes
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\operations\prepare.py", line 224, in prepare_linked_requirement
    req, self.req_tracker, finder, self.build_isolation,
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\operations\prepare.py", line 49, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\distributions\source\legacy.py", line 34, in prepare_distribution_metadata
    self.req.load_pyproject_toml()
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\req\req_install.py", line 537, in load_pyproject_toml
    str(self)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\pyproject.py", line 66, in load_pyproject_toml
    pp_toml = pytoml.load(f)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_vendor\pytoml\parser.py", line 11, in load
    return loads(fin.read(), translate=translate, object_pairs_hook=object_pairs_hook, filename=getattr(fin, 'name', repr(fin)))
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_vendor\pytoml\parser.py", line 24, in loads
    ast = _p_toml(src, object_pairs_hook=object_pairs_hook)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_vendor\pytoml\parser.py", line 341, in _p_toml
    s.expect_eof()
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_vendor\pytoml\parser.py", line 123, in expect_eof
    return self._expect(self.consume_eof())
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_vendor\pytoml\parser.py", line 163, in _expect
    raise TomlError('msg', self._pos[0], self._pos[1], self._filename)
TomlError: c:\users\predator\appdata\local\temp\pip-install-pefua3\plumbum\pyproject.toml(69, 1): msg
Traceback (most recent call last):
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\ghpythonremote\_configure_ironpython_installation.py", line 40, in <module>
    subprocess.check_call(pip_cmd)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\PREDATOR\\anaconda3\\envs\\rhinoremote\\python.exe', '-m', 'pip', 'install', '--upgrade', '--target=C:\\Users\\PREDATOR\\AppData\\Roaming\\McNeel\\Rhinoceros\\7.0\\Plug-ins\\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\\settings\\lib', '--no-compile', '--ignore-requires-python', 'gh-python-remote']' returned non-zero exit status 2`

Also i can tell you that there is no file in: "%APPDATA%\McNeel\Rhinoceros\7.0\Plug-ins^ IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib" nor in "%APPDATA%\Grasshopper\UserObjects\gh-python-remote\examples" (but i do find them in rhinoremote env folder). No ghpythonremote components appear, but i can drag it on from rhinoremote env folder as well (but as you can imagine, it doesn't work and outputs: Runtime error (ImportException): No module named ghpythonremote). I've tried giving the envlist path for the location input, but also doesn't work.

I really hope i'm not wasting your time with something really silly to solve, but i can't find what i'm doing wrong.

Supermonkey-design avatar Oct 07 '22 07:10 Supermonkey-design

Hi @Supermonkey-design , I can't tell what is going wrong from the error message you sent. Can you run the command C:\Users\PREDATOR\anaconda3\envs\rhinoremote\python.exe -m pip install --upgrade --target=C:\Users\PREDATOR\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib --no-compile --ignore-requires-python gh-python-remote in a command line with the Rhino remote environment activated, and send me the error it reports?

Also, if you are able to use either Hops (Rhino 7 and later) or RhinoCode (Rhino 8 and later), I'd recommend you do so as they have better support and are easier to install and use in Rhino.

Hops: https://developer.rhino3d.com/guides/compute/hops-component/#calling-a-cpython-server RhinoCope: https://discourse.mcneel.com/t/rhino-8-feature-rhinocode-cpython-csharp/128353

pilcru avatar Oct 10 '22 15:10 pilcru

Hi @pilcru, thanks for the reply! I've tried to run the command with anaconda, powershell and windows prompt (last with as admin too). Here is the error:

(base) C:\Users\PREDATOR>conda activate rhinoremote

(rhinoremote) C:\Users\PREDATOR>C:\Users\PREDATOR\anaconda3\envs\rhinoremote\python.exe -m pip install --upgrade --target=C:\Users\PREDATOR\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib --no-compile --ignore-requires-python gh-python-remote
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Invalid requirement: '(814d908a-e25c-493d-97e9-ee3861957f49)\\settings\\lib'
Hint: It looks like a path. File '(814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib' does not exist.

but honestly i don't get it. The path is right as you can see from the screenshot.

Immagine 2022-10-10 194400

i use a lot hops, but honestly didn't know i could use it to run CPython. I also have rhino8 wip so i will try RhinoCode as well. Thank you!!

Supermonkey-design avatar Oct 10 '22 17:10 Supermonkey-design

Sorry I forgot to escape paths when pasting the command. Can you try this instead: C:\Users\PREDATOR\anaconda3\envs\rhinoremote\python.exe -m pip install --upgrade --target="C:\Users\PREDATOR\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib" --no-compile --ignore-requires-python gh-python-remote, and report back?

Thanks.

pilcru avatar Oct 10 '22 18:10 pilcru

Sure and sorry if i didn't notice. This is what i get now:

(rhinoremote) C:\Users\PREDATOR>C:\Users\PREDATOR\anaconda3\envs\rhinoremote\python.exe -m pip install --upgrade --target="C:\Users\PREDATOR\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib" --no-compile --ignore-requires-python gh-python-remote
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting gh-python-remote
  Using cached https://files.pythonhosted.org/packages/0b/15/757df4424310efdfff9ed0fc314a613ef76d085067ab7666be90b3895556/gh_python_remote-1.4.4-py2-none-any.whl
Collecting rpyc==4.1.5
  Using cached https://files.pythonhosted.org/packages/36/a7/7898de583e17202ce02ac7ecffdbed95c72a6cebe468c1ee6fc94fc20933/rpyc-4.1.5-py2-none-any.whl
Collecting plumbum
  Using cached https://files.pythonhosted.org/packages/5f/c9/67b40a607f9815275c7867f9ec60700f442c186d3cca235156cb4fa19c33/plumbum-1.8.0.tar.gz
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\cli\base_command.py", line 153, in _main
    status = self.run(options, args)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\commands\install.py", line 382, in run
    resolver.resolve(requirement_set)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\legacy_resolve.py", line 201, in resolve
    self._resolve_one(requirement_set, req)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\legacy_resolve.py", line 365, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\legacy_resolve.py", line 313, in _get_abstract_dist_for
    req, self.session, self.finder, self.require_hashes
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\operations\prepare.py", line 224, in prepare_linked_requirement
    req, self.req_tracker, finder, self.build_isolation,
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\operations\prepare.py", line 49, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\distributions\source\legacy.py", line 34, in prepare_distribution_metadata
    self.req.load_pyproject_toml()
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\req\req_install.py", line 537, in load_pyproject_toml
    str(self)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_internal\pyproject.py", line 66, in load_pyproject_toml
    pp_toml = pytoml.load(f)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_vendor\pytoml\parser.py", line 11, in load
    return loads(fin.read(), translate=translate, object_pairs_hook=object_pairs_hook, filename=getattr(fin, 'name', repr(fin)))
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_vendor\pytoml\parser.py", line 24, in loads
    ast = _p_toml(src, object_pairs_hook=object_pairs_hook)
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_vendor\pytoml\parser.py", line 341, in _p_toml
    s.expect_eof()
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_vendor\pytoml\parser.py", line 123, in expect_eof
    return self._expect(self.consume_eof())
  File "C:\Users\PREDATOR\anaconda3\envs\rhinoremote\lib\site-packages\pip\_vendor\pytoml\parser.py", line 163, in _expect
    raise TomlError('msg', self._pos[0], self._pos[1], self._filename)
TomlError: c:\users\predator\appdata\local\temp\pip-install-nliy5e\plumbum\pyproject.toml(69, 1): msg

Supermonkey-design avatar Oct 10 '22 18:10 Supermonkey-design

The latest update to plumbum (a dependency of the gh-python-remote package) dropped support for Python 2. I'll update the installation files here later this week so the correct version gets installed. Thanks for bringing this up.

Meanwhile, installing the correct version manually should get you unstuck: C:\Users\PREDATOR\anaconda3\envs\rhinoremote\python.exe -m pip install --upgrade --target="C:\Users\PREDATOR\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib" --no-compile --ignore-requires-python gh-python-remote plumbum==1.7.2. The example files and GH components will not get installed but as you've found out already you can copy them from elsewhere.

pilcru avatar Oct 11 '22 13:10 pilcru

Oh ok, thank you! And btw in the meantime i've started using Hops to access some CPython scripts and libraries, so thanks again for your help and pointing me out the solutions!

Supermonkey-design avatar Oct 11 '22 13:10 Supermonkey-design