question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ape console fails to load on macOS 12.2 w/ venv

See original GitHub issue

Environment information

  • ape and plugin versions:
$ ape --version
0.1.0b5

$ ape plugins list
No secondary plugins installed. Use '--all' to see available plugins.

* Python Version: 3.8.12
* OS: macOS 12.2.1 (21D62)

What went wrong?

I freshly installed “ape” on my macbook and was testing each of the high level commands and noticed that one of the commands “console” did not Error out gracefully.

  • what command you ran ape console

  • full output of the error you received

(ape_venv) ZKPunks-MacBook-Pro:ape_experiments ZKPunk$ ape console
Traceback (most recent call last):
  File "/Users/ZKPunk/py_venv/ape_venv/bin/ape", line 8, in <module>
    sys.exit(cli())
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/ape/_cli.py", line 40, in invoke
    return super().invoke(ctx)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/ape/cli/commands.py", line 18, in invoke
    super().invoke(ctx)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/ape_console/_cli.py", line 24, in cli
    return console(verbose=verbose)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/ape_console/_cli.py", line 61, in console
    IPython.embed(colors="Neutral", banner1=banner, user_ns=namespace)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/IPython/terminal/embed.py", line 397, in embed
    shell = InteractiveShellEmbed.instance(_init_location_id='%s:%s' % (
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/traitlets/config/configurable.py", line 540, in instance
    inst = cls(*args, **kwargs)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/IPython/terminal/embed.py", line 168, in __init__
    super(InteractiveShellEmbed,self).__init__(**kw)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 619, in __init__
    super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 529, in __init__
    self.init_virtualenv()
  File "/Users/ZKPunk/py_venv/ape_venv/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 788, in init_virtualenv
    new_path = p.readlink()
AttributeError: 'PosixPath' object has no attribute 'readlink'

How can it be fixed?

I am yet to dig into the actual cause of the error; maybe “console” expects a plugin to be installed, if thats the case it should still be handled gracefully.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fubuloubucommented, Mar 4, 2022

Also what virtualenv are you using? I see init_virtualenv in the stack trace, making me think it’s related to that.

Probably a good quetsion to ask on the issue template… 🤔

0reactions
fubuloubucommented, Mar 4, 2022

for those reading at home, run this first before installing eth-ape:

$ pip install -U pip
Read more comments on GitHub >

github_iconTop Results From Across the Web

Virtualenv does not work correctly on python 2.7 from ... - GitHub
Issue Hello, we faced an issuie with virtualenv when it is used in python, downloaded form python.org: ...
Read more >
If an error occurred while updating or installing macOS
Turn on or restart your Mac, then immediately press and hold the Shift key as your Mac starts up. Release the key when...
Read more >
Error creating virtualenv on Mac OSX sierra - python
I have the same problem on ubuntu on VM ware. I find the solution here pip install pip -U pip install pipenv -U...
Read more >
How To Install Virtualenv on Mac OS - deadbearcode
Quick walkthrough on how to install Virtualenv on Mac OS two different ways. This is an easy way to manage Python and it's...
Read more >
How to activate Python venv on a Mac? | by Manzeel Uprety
Now, its time for you install the venv or virtual environment in Python using the following command. python3.9 -m pip install --user virtualenv...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found