How to install Brian 1

I often encounter codes in Brian 1 that usually take too much time for converting to Brian 2 and some times I fail to reproduce the original results. I tried to install Brian 1 but I get many errors for inconsistency of package dependency.

Could you please guide?
I use an environment for Python 2 and install all the packages.
Just a guess:
I think if there is a requirement.txt file with valid version of dependency package == > < v ?.? solve many issues.

best,

$ cd brian-1.4.4
$ pip install -e .

Error initializing plugin EntryPoint(name='Windows (alt)', value='keyrings.alt.Windows', group='keyring.backends').
Traceback (most recent call last):
  File "/home/abolfazl/.local/lib/python3.6/site-packages/keyring/backend.py", line 198, in _load_plugins
    init_func = ep.load()
  File "/usr/local/lib/python3.6/dist-packages/importlib_metadata/__init__.py", line 95, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
    from . import file_base
  File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint(name='file', value='keyrings.alt.file', group='keyring.backends').
Traceback (most recent call last):
  File "/home/abolfazl/.local/lib/python3.6/site-packages/keyring/backend.py", line 198, in _load_plugins
    init_func = ep.load()
  File "/usr/local/lib/python3.6/dist-packages/importlib_metadata/__init__.py", line 95, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/file.py", line 11, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint(name='pyfs', value='keyrings.alt.pyfs', group='keyring.backends').
Traceback (most recent call last):
  File "/home/abolfazl/.local/lib/python3.6/site-packages/keyring/backend.py", line 198, in _load_plugins
    init_func = ep.load()
  File "/usr/local/lib/python3.6/dist-packages/importlib_metadata/__init__.py", line 95, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/pyfs.py", line 8, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/abolfazl/Desktop/whatch%20later/akam2010/Python2_env/brian-1.4.4
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/abolfazl/Desktop/whatch later/akam2010/Python2_env/brian-1.4.4/setup.py'"'"'; __file__='"'"'/home/abolfazl/Desktop/whatch later/akam2010/Python2_env/brian-1.4.4/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-1wolw5nj
         cwd: /home/abolfazl/Desktop/whatch later/akam2010/Python2_env/brian-1.4.4/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/abolfazl/Desktop/whatch later/akam2010/Python2_env/brian-1.4.4/setup.py", line 31
        except CCompilerError, ex:
                             ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!

Update:

pip install --upgrade keyrings.alt
$ pip install -e . 
Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/abolfazl/Desktop/whatch%20later/akam2010/Python2_env/brian-1.4.4
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/abolfazl/Desktop/whatch later/akam2010/Python2_env/brian-1.4.4/setup.py'"'"'; __file__='"'"'/home/abolfazl/Desktop/whatch later/akam2010/Python2_env/brian-1.4.4/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-xlk8j73v
         cwd: /home/abolfazl/Desktop/whatch later/akam2010/Python2_env/brian-1.4.4/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/abolfazl/Desktop/whatch later/akam2010/Python2_env/brian-1.4.4/setup.py", line 31
        except CCompilerError, ex:
                             ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Hi. I will look into preparing some kind of frozen requirements file for Brian 1 (or maybe a container). In general, the minimal requirements should work (i.e. Python 2.7 with numpy 1.4.1, scipy 0.7.0 and sympy 0.7.1).

In your specific case, the issue is not coming directly from Brian: you are using a Python 2 environment, but somehow it picks up a local Python 3 installation of the keyring package (in ~/.local/lib/python3.6/site-packages/keyring/) – maybe this directory is manually set via PYTHONPATH? It might also simply be that your Python 2 environment does not have pip installed and so it picks up a Python 3 pip from elsewhere. A good habit is to use python -m pip install instead of pip install to make sure that the pip tied to the current Python interpreter is used.

Thank you, The error from keyring resolved after this:

The Brian 1 container would be great.

Oh sorry, I did not see this.
But it still uses Python 3 which is the reason for the error:

command: /usr/bin/python3 -c ...

It might just be an issue of using the wrong pip.

1 Like

It resolved the error. Just I had some error importing scipy 0.8.0, but scipy 0.9.0 worked.
Thank you :slight_smile:
best,