0

If I try to import brownie in python script I get the following:

Traceback (most recent call last):
  File "*filepath*", line 3, in <module>
    from brownie import *
ModuleNotFoundError: No module named 'brownie'

If I try to run 'brownie console' i get the following:

INFO: Could not find files for the given pattern(s).
Brownie v1.19.0 - Python development framework for Ethereum

No project was loaded.
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'C:\Users\user\AppData\Roaming\npm\node_modules\ganache\dist\node\cli.js'
←[90m    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m
←[90m    at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m
←[90m    at node:internal/main/run_main_module:17:47←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m,
  requireStack: []
}
  File "C:\Users\user\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\_cli\__main__.py", line 64, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "C:\Users\user\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\_cli\console.py", line 58, in main
    network.connect(CONFIG.argv["network"])
  File "C:\Users\user\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\main.py", line 50, in connect
    rpc.launch(active["cmd"], **active["cmd_settings"])
  File "C:\Users\user\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\__init__.py", line 76, in launch
    self.process = self.backend.launch(cmd, **kwargs)
  File "C:\Users\user\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py", line 70, in launch
    ganache_version = get_ganache_version(cmd_list[0])
  File "C:\Users\user\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py", line 115, in get_ganache_version
    raise ValueError("could not read ganache version: {}".format(ganache_version_stdout))
ValueError: could not read ganache version: b''

What could be causing this? I installed brownie using pipx and I was able to run brownie console just yesterday. When I opened VScode this morning it told me to install python extensions and that's what I did, perhaps that messed something up? Any help would be appreciated.

mojo45
  • 23
  • 3

2 Answers2

0

Open up a terminal from upper menu bar where it says terminal then open new terminal then type

python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install eth-brownie

Check: https://github.com/eth-brownie/brownie

then restart the vscode then you can Import it. Also check for typo's While importing. And installing the brownie If my Reply Helped you It would be great if you can upvote.

chiliad
  • 1
  • 2
  • I have done all of these so i just get that pipx is already installed, pipx is already on path, and eth-brownie is already installed. – mojo45 Jul 27 '22 at 23:07
0

Pipx seems to be the source of the issue so I went ahead and installed using regular pip instead and it worked.

mojo45
  • 23
  • 3