I have the following boilerplate code
from scamp import *
s = Session()
s.tempo = 120
clarinet = s.new_part("clarinet")
When I run it, I get the error
Traceback (most recent call last):
File "/home/norhther/Descargas/music.py", line 6, in <module>
clarinet = s.new_part("clarinet")
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/instruments.py", line 184, in new_part
instrument.add_soundfont_playback(preset=preset, soundfont=soundfont, num_channels=num_channels,
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/instruments.py", line 984, in add_soundfont_playback
SoundfontPlaybackImplementation(bank_and_preset=preset, soundfont=soundfont, num_channels=num_channels,
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/playback_implementations.py", line 327, in __init__
SoundfontHost(
File "/home/norhther/.local/lib/python3.9/site-packages/scamp/_soundfont_host.py", line 176, in __init__
raise ModuleNotFoundError("FluidSynth not available.")
ModuleNotFoundError: FluidSynth not available.
I installed FluidSynth in my system (Ubuntu) and I can execute it with no problem. I also used pip install pyFluidSynth with pip
Note: This answer predates OP editing the question; The question indeed contained the quoted phrase.
I also used pip install fluidsynth with pip
The fluidsynth package on PyPI was last updated in 2012, and is not what SCAMP depends on for interfacing with FluidSynth. The correct package to be installed is called pyFluidSynth. To install it, run the following command.
pip install pyFluidSynth
You'll also have to uninstall the wrong fluidsynth package.
pip uninstall fluidsynth
Related
I bought a MacBook Pro 13 M1 (16 GB RAM, 1 TB SSD) and I'm trying to get it setup for work and part of that is using python 2 (yes I know it's end of life, I still need to use it till we finish porting to go). I have some python packages I'd like to remove from my system python2 (I'm sure I must've run sudo pip install on these at some point, which I know was stupid, but what is done is done) and now that I'm on Big Sur I can't remove these packages. I tried disabling SIP until I can get them removed (csrutil disable from recovery), but now I'm getting errors that I can't remove files from a read only filesystem
sudo pip uninstall cryptography 2 14:34
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
WARNING: The directory '/Users/darren/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Found existing installation: cryptography 3.3.2
Uninstalling cryptography-3.3.2:
Would remove:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography-3.3.2-py2.7.egg-info
Proceed (y/n)? y
ERROR: Exception:
Traceback (most recent call last):
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
status = self.run(options, args)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/commands/uninstall.py", line 90, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/req/req_install.py", line 686, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/req/req_uninstall.py", line 403, in remove
moved.stash(path)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/req/req_uninstall.py", line 292, in stash
renames(path, new_path)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/pip/_internal/utils/misc.py", line 355, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 323, in move
rmtree(src)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 270, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 275, in rmtree
onerror(os.remove, fullname, sys.exc_info())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 273, in rmtree
os.remove(fullname)
OSError: [Errno 30] Read-only file system: '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/_der.py'
but I can't remount root as read/write and get this error when I try:
sudo mount -uw /
mount_apfs: volume could not be mounted: Permission denied
mount: / failed with 66
How do I remove these files from /System/Library if it's read only? Do I have to format my system and start from scratch now that mac os put these files in a read only filesystem or is there a way to remove them?
Edit:
So I have broken packages in /System/Library that are preventing fabric from running so I can't get our stuff up and running. The main one being the cryptography package. So I either need to fix these packages so fabric can run or remove them or something.
The other part that makes this such a pain is that I'm trying to run python 2 on an M1 Mac which means either using the built in python or using rosetta with an x86 python2 as I have found no method for installing arm python 2 on an M1 Mac (there isn't an installer from python.org or brew since python2 was end of life when the M1 Macs shipped).
Edit2:
Maybe these packages that I'm having issues with did ship with Mac OS as the package's folder's created timestamp is "Jan 1 01:00:00 2020" just like every other file & folder in that same folder. If so I guess I need to fix them somehow. When I try to run fab from the command line I get this error in the cryptography package:
fab
/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography.hazmat.backends import default_backend
Traceback (most recent call last):
File "/Users/darren/Library/Python/2.7/bin/fab", line 5, in <module>
from fabric.main import program
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/fabric/__init__.py", line 3, in <module>
from .connection import Config, Connection
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/fabric/connection.py", line 16, in <module>
from paramiko.agent import AgentRequestHandler
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/transport.py", line 129, in <module>
class Transport(threading.Thread, ClosingContextManager):
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/transport.py", line 190, in Transport
if KexCurve25519.is_available():
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/kex_curve25519.py", line 30, in is_available
X25519PrivateKey.generate()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/primitives/asymmetric/x25519.py", line 39, in generate
from cryptography.hazmat.backends.openssl.backend import backend
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
from cryptography.hazmat.backends.openssl.backend import backend
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/backends/openssl/backend.py", line 117, in <module>
from cryptography.hazmat.bindings.openssl import binding
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/bindings/openssl/binding.py", line 14, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: dlopen(/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/bindings/_openssl.so, 2): Symbol not found: _DTLS_client_method
Referenced from: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cryptography/hazmat/bindings/_openssl.so
Expected in: flat namespace
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/transport.py", line 120, in _join_lingering_threads
for thr in _active_threads:
TypeError: 'NoneType' object is not iterable
Error in sys.exitfunc:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/Users/darren/Library/Python/2.7/lib/python/site-packages/paramiko/transport.py", line 120, in _join_lingering_threads
for thr in _active_threads:
TypeError: 'NoneType' object is not iterable
Has anyone else had this problem or have a fix for it?
I was able to install python2 for Apple Silicon/M1 from nix and then I had to manually install pip which let me install cryptography & cffi (I had libffi installed from brew). Here are the steps I used, I'm not sure if they're all necessary, but it's what I did:
Install Nix
see https://nixos.org/manual/nix/stable/#sect-macos-installation for more details, but if you have a mac with a T2 chip or M1 this will still be encrypted
sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
Install python2 from nix
nix-env -i python-2.7.18
verify that you're using this python in a new terminal session (you'll need to start a new shell to get the updated path)
run which python
if it doesn't return something like /Users/user/.nix-profile/bin/python you'll want to add ~/.nix-profile/bin to the front of your path, start a new shell, and run which python again
Install pip
See https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py for more details, but if you curl the get-pip.py in this url and run it with python 2 it'll tell you to instead download and use the get-pip.py from https://bootstrap.pypa.io/pip/2.7/get-pip.py
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python ./get-pip.py
Use brew to install libiff and openssl#1.1
I had done this step previously and I'm not 100% sure it's necessary, but I believe it is
brew install libiff openssl#1.1
Add the following to your .bashrc, .zshrc, .profile, or wherever you set your environment variables:
export LDFLAGS="-L$(brew --prefix openssl#1.1)/lib"
export CFLAGS="-I$(brew --prefix openssl#1.1)/include"
use pip to install cryptography
pip install cryptography
After this I had a functional python with cryptography installed and I was then able to install fabric (via pip install fabric==1.14.1 since 1.14.1 is the version I need for this old project, use what you need)
Edit:
Thanks to #CharlesDuffy for all of his help and as he correctly mentions in the comments bellow, you could (and probably should) install all of the dependencies and cryptography from nix instead of using a combination of brew and nix. I had brew and the dependancies installed before I had Nix installed so I haven't tested it out, but it should work.
I had some problems with upgrading matplotlib recently so I ended up installing different versions of Python on my Mac (Sierra) via brew, and then uninstalled afterwards. However, now matplotlib works (2.0.2) but whenever I run a particular python script that used to work I get an error which I didn't have before:
Traceback (most recent call last):
File "sim.py", line 254, in <module>
main()
File "sim.py", line 118, in main
db = shelve.open('.sim_balance', 'c')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 243, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 227, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/anydbm.py", line 84, in open
mod = __import__(result)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/dbhash.py", line 7, in <module>
import bsddb
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bsddb/__init__.py", line 67, in <module>
import _bsddb
ImportError: No module named _bsddb
According to my searches online this has something to do with my brew installed python interfering? I also deleted all my files in /Library/Python/2.7/site-packages yesterday which may have caused this as well.
I have tried homebrew brew install berkeley-db but then pip install bsddb3 yields:
Terrys-MBP:site-packages Terry$ pip install bsddb3
Collecting bsddb3
Using cached bsddb3-6.2.4.tar.gz
Complete output from command python setup.py egg_info:
Can't find a local Berkeley DB installation.
(suggestion: try the --berkeley-db=/path/to/bsddb option)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/m5/1fg5rnj11_9cz5pntlqlwzyc0000gn/T/pip-build-elBAFK/bsddb3/
EDIT: Solved. Installed anaconda, installed bsddb via conda install and everything is working now.
Solved. I Installed anaconda, installed bsddb via conda install and everything is working now.
Using OSX El Capitan. Just installed a bunch of pip module and was following a few online tutorials, must have broken something as now I get the following error whenever I try to use pip (although python seems to run fine).
$ pip install pandas
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2837, in <module>
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 451, in _build_master
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 464, in _build_from_requirements
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 639, in resolve
pkg_resources.DistributionNotFound: pip==1.5.6
Any helping fixing would be much appreciated.
Thanks.
Reinstall using easy_install. Close the terminal and reopen. Pip should now work.
Try updating pip first by typing pip install -U pip and the try pip install pandas. I myself use Anaconda/Miniconda. Most of the packages are well handled and the dependencies are taken care of as well by the conda package manager.
What do I do wrong?
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==7.1.0', 'console_scripts', 'pip')()
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1- py3.4.egg/pkg_resources/__init__.py", line 558, in load_entry_point
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2682, in load_entry_point
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2355, in load
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2361, in resolve
ImportError: No module named 'pip'
Stackoverflow asked me to type more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more
Try to fix pip installation with:
sudo apt-get install python3-pip
I've had the same issue and this worked for me. Maybe it's because you only installed pip for an earlier version of python or you intalled it from source and not from you distributions package management.
It sounds like your pip variable isn't set or you're trying to use conflicting environments. If you want to get the python package pymongo installed on your 3.4 version look to use:
/usr/local/bin/pip3.4 install pymongo
Then you can verify by testing in the 3.4 interpreter by running:
python3.4
>>>import pymongo
>>>
In the future look at using virtualenvs, they can be really easy and clean to work with while controlling your packages neatly. Hope this helps!
I am running python based software that requires a virtualenv with various additional python packages installed therein. Here are the install instructions:
Clone the repository to a shared filesysem on a cluster
>git clone https://github.com/jgurtowski/nanocorr
>cd nanocorr
Create a virtual environment to install python dependencies
>virtualenv nanocorr_ve
>source nanocorr_ve/bin/activate
install the following packages using pip:
pip install git+https://github.com/cython/cython
pip install numpy
pip install h5py
pip install git+https://github.com/jgurtowski/pbcore_python
pip install git+https://github.com/jgurtowski/pbdagcon_python
pip install git+https://github.com/jgurtowski/jbio
pip install git+https://github.com/jgurtowski/jptools
#Finally install the nanocorr package itself
> python setup.py install
I achieved this with no problems. However, While running the software, I found that it was failing with the following traceback.
(nanocorr_ve)[nanocorr_test]$ correctOxford
Traceback (most recent call last):
File "/local/workdir/malonge/nanocorr_test/nanocorr/nanocorr_ve/bin/correctOxford", line 9, in <module>
load_entry_point('jptools==0.1', 'console_scripts', 'correctOxford')()
File "/local/workdir/malonge/nanocorr_test/nanocorr/nanocorr_ve/lib/python2.7/site- packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/local/workdir/malonge/nanocorr_test/nanocorr/nanocorr_ve/lib/python2.7/site- packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/local/workdir/malonge/nanocorr_test/nanocorr/nanocorr_ve/lib/python2.7/site- packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/local/workdir/malonge/nanocorr_test/nanocorr/nanocorr_ve/lib/python2.7/site- packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/local/workdir/malonge/nanocorr_test/nanocorr/nanocorr_ve/lib/python2.7/site- packages/jptools/correct.py", line 21, in <module>
from pbtools.pbdagcon.q_sense import output_dag_info
File "/local/workdir/malonge/nanocorr_test/nanocorr/nanocorr_ve/lib/python2.7/site- packages/pbtools/pbdagcon/q_sense.py", line 50, in <module>
from pbcore.io import FastaReader
File "/programs/python/lib/python2.7/site-packages/pbcore-1.0.0- py2.7.egg/pbcore/io/__init__.py", line 31, in <module>
from .BasH5IO import *
File "/programs/python/lib/python2.7/site-packages/pbcore-1.0.0- py2.7.egg/pbcore/io/BasH5IO.py", line 37, in <module>
import h5py, numpy as np, os.path as op
File "/programs/python/lib/python2.7/site-packages/h5py-2.5.0-py2.7-linux- x86_64.egg/h5py/__init__.py", line 13, in <module>
from . import _errors
ImportError: /programs/python/lib/python2.7/site-packages/h5py-2.5.0-py2.7-linux-x86_64.egg/h5py/_errors.so: undefined symbol: PyUnicodeUCS2_DecodeUTF8
I have found details as to the specific error itself, but I think the source of the problem is that the traceback clearly shows a transition from modules being imported from the /local virtualenv site-packages to another site-packages directory in /programs.
My question is the following: Given that I have the same python packages installed in two separate places, 1 in the system wide location and one in virtualenv, how do I ensure that other programs properly import all modules from within the same virtualenv sit-packages directory. I thought this would have been done automatically. I am not 100% sure that this is the sole reason for the error, but being able to fix this would help me to further debug.
It depends on how you set up your env. virtualenv has a flag option that forces it to not use the system site packages
virtualenv --no-site-packages my_env
It is the default behavior for recent versions (>=1.7).
If you've defined a PYTHONPATH environment variable, that will affect your virtualenv environment as well.