AttributeError: module 'pysynth' has no attribute 'make_wav' - python

AttributeError: module 'pysynth' has no attribute 'make_wav'
import pysynth as ps
test = (('c', 4), ('e', 4), ('g', 4), ('c5', -2), ('e6', 8), ('d#6', 2))
ps.make_wav(test, fn = "test.wav")

pip version pysynth of pysynth is outdated. If you installed pysynth through pip, uninstall it, and install from github repository.
pip uninstall pysynth
git clone https://github.com/mdoege/PySynth.git
cd PySynth
python3 setup.py install

Related

How to force install package with Pip?

I am trying to install pyside with Python 3.8. It is stating that I need Python [(2, 6), (2, 7), (3, 2), (3, 3), (3, 4)]. Is there a way I can force install and override this requirement?

Is Pyside not compatible with python 3.6.4? [duplicate]

This question already has an answer here:
Installing PySide for Python3
(1 answer)
Closed 4 years ago.
I followed the steps to install Pyside on my macOS 13.13.4 on Python 3.6.4 on this Github page but after runninng pip install -U PySide, I got the following error message which seems to indicate that Pyside is not compatible to Python 3.6.4 ??:
mymacs-MacBook-Pro:~ mymac$ pip install -U PySide
Collecting PySide
Using cached https://files.pythonhosted.org/packages/36/ac/ca31db6f2225844d37a41b10615c3d371587677efd074db29855e7035de6/PySide-1.2.4.tar.gz
Complete output from command python setup.py egg_info:
only these python versions are supported: [(2, 6), (2, 7), (3, 2), (3, 3), (3, 4)]
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/jq/yyp9q2fs1z5780k9l1_2ph4r0000gn/T/pip-install-zz9h16bx/PySide/
mymacs-MacBook-Pro:~ mymac$
Is I have anaconda, I looked at this website and this stackoverflow page I tried conda install -c anaconda pyside and conda install -c conda-forge pyside but both of them also threw this same error message:
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- pyqt
- pyside
Use "conda info <package>" to see the dependencies for each package.
Many thanks in advance for your help!
It seems according to stackoverflow page that Pyside will not be updated for version of python 3.5+. Instead, Pyside2 should be installed. The Installation instructions can be found here

No such module psutil, even though psutil is installed

I am on OS X El Capitan.
I want to import psutil for a python script, but get module psutil not found.
If I do pip install psutil I get psutil already installed.
How is this possible that I have psutil installed, but it does not find it in the script?
I am using both macports and homebrew to install several python packages. Maybe this is a problem?
Any ideas how I can get psutil to import?
I have python27 and python34 on my system. For this project I need to use python27.
This is my log for pip freeze
altgraph==0.10.2
bdist-mpkg==0.5.0
bonjour-py==0.3
chardet==2.3.0
git-remote-helpers==0.1.0
macholib==1.5.1
matplotlib==1.3.1
modulegraph==0.10.4
numpy==1.8.0rc1
PocketSphinx==0.8
psutil==4.0.0
py2app==0.7.3
PyAudio==0.2.9
pygal==2.1.1
pyobjc-core==2.5.1
pyobjc-framework-Accounts==2.5.1
pyobjc-framework-AddressBook==2.5.1
pyobjc-framework-AppleScriptKit==2.5.1
pyobjc-framework-AppleScriptObjC==2.5.1
pyobjc-framework-Automator==2.5.1
pyobjc-framework-CFNetwork==2.5.1
pyobjc-framework-Cocoa==2.5.1
pyobjc-framework-Collaboration==2.5.1
pyobjc-framework-CoreData==2.5.1
pyobjc-framework-CoreLocation==2.5.1
pyobjc-framework-CoreText==2.5.1
pyobjc-framework-DictionaryServices==2.5.1
pyobjc-framework-EventKit==2.5.1
pyobjc-framework-ExceptionHandling==2.5.1
pyobjc-framework-FSEvents==2.5.1
pyobjc-framework-InputMethodKit==2.5.1
pyobjc-framework-InstallerPlugins==2.5.1
pyobjc-framework-InstantMessage==2.5.1
pyobjc-framework-LatentSemanticMapping==2.5.1
pyobjc-framework-LaunchServices==2.5.1
pyobjc-framework-Message==2.5.1
pyobjc-framework-OpenDirectory==2.5.1
pyobjc-framework-PreferencePanes==2.5.1
pyobjc-framework-PubSub==2.5.1
pyobjc-framework-QTKit==2.5.1
pyobjc-framework-Quartz==2.5.1
pyobjc-framework-ScreenSaver==2.5.1
pyobjc-framework-ScriptingBridge==2.5.1
pyobjc-framework-SearchKit==2.5.1
pyobjc-framework-ServiceManagement==2.5.1
pyobjc-framework-Social==2.5.1
pyobjc-framework-SyncServices==2.5.1
pyobjc-framework-SystemConfiguration==2.5.1
pyobjc-framework-WebKit==2.5.1
pyOpenSSL==0.13.1
pyparsing==2.0.1
python-dateutil==1.5
pytz==2013.7
scipy==0.13.0b1
six==1.4.1
SphinxBase==0.8
vboxapi==1.0
wheel==0.26.0
xattr==0.6.4
zope.interface==4.1.1
I was unable to reproduce your problem in a virtualenv, below are the steps I used.
Desktop $ virtualenv -p python2.7 virtenv
Desktop $ cd virtenv
virtenv $ source bin/activate
(virtenv) $ sudo pip install psutil
(virtenv) $ python
(virtenv) > import psutil
(virtenv) > exit()
(virtenv) $ deactivate
You could try removing it and reinstalling it.
Just tried to run glances, some kind of diagnostic tool that requires psutil aswell. Unfortunatelly got an error :
PsUtil module not found. Glances cannot start.
Ran pip freeze, saw that i had it installed and i decided to remove and try to reinstall. Uninstalled (Successfully uninstalled psutil-5.0.1) and when tried again to install psutil-5.0.1 failed. Ran again pip freeze and noticed there is a minor version (psutil==2.2.1) that is served in case you remove the latest (very strange).
Anyway, run again pip uninstall psutil, removed that minor version and when i tried again to reinstall worked correctly, installing the last version.
Now everything works ok.
LE: Python 2.7.5

Updating the SQLite3 build on my python install

noob programmer here, I'm trying to get the SQLite3 on my Python installation up-to-date (I currently have version 3.6.11, whereas I need at least version 3.6.19, as that is the first version that supports foreign keys). Here's my problem, though: I have no idea how to do this. I know next to nothing about the command line, and I don't really know what files to replace (if at all) in my python install. And before anyone asks, I'm already using the latest Pysql version – it's what's not up to date. Can anyone give me some pointers, or maybe a guide on how to update this?
I'm on Mac OSX 10.5.8, working with python 2.6.
I suggest using the 'pip' command on the command line.
pip search sqlite
pip install pysqlite
I just came fresh from installing this both in Mavericks and Mountain Lion.
This SO article mentions using the build_static method, which they say retrieves that latest version of the sqlite amalgamation. For some reason it didn't work (ie it didn't seem to download it or use it)
What I ended up doing was
Downloaded pysqlite as a tarball
Downloaded latest sqlite source amalgamation
Unzipped pysqlite into its folder
Unzipped sqlite and copied that to the pysqlite folder
Opened setup.cfg and commented out all of the directives
In Terminal, went to the pysqlite folder, and then:
$ python setup.py build_static install
This compiled pysqlite using the libraries from the latest sqlite sources. And then in Python, I used it as:
import pysqlite2.dbapi2 as sqlite3
I recently installed python from source and used the following commands to install both SQLite from source and Python 2.7.13 from source.
for SQLite3 you can use the following commands
$SQLITE_INSTALL_LOCATION
$ curl -O http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz
$ tar xvfz sqlite-autoconf-3070603.tar.gz
$ cd sqlite-autoconf-3070603
$ ./configure --prefix=$SQLITE_INSTALL_LOCATION --disable-static CFLAGS="-g"
$ make && make install
Then when I compiled my python I edited the setup.py in the root of the Python source
$ curl -O https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
$ tar xvfz Python-2.7.13.tgz
Python-2.7.13/setup.py -- add the path to your SQLite install here:
```
...
# We hunt for #define SQLITE_VERSION "n.n.n"
# We need to find >= sqlite version 3.0.8
sqlite_incdir = sqlite_libdir = None
sqlite_inc_paths = [ '/usr/include',
'/usr/include/sqlite',
'/usr/include/sqlite3',
'/usr/local/include',
'/usr/local/include/sqlite',
'/usr/local/include/sqlite3',
$SQLITE_INSTALL_LOCATION/include,
]
...
Once you've changed the setup.py in your python source finish up compiling and installing python assuming the install location is $PYTHON_INSTALL_LOCATION
$ cd Python-2.7.13
$ LD_RUN_PATH=$SQLITE_INSTALL_LOCATION/lib ./configure --prefix=$PYTHON_INSTALL_LOCATION --enable-shared --enable-unicode=ucs4
$ LD_RUN_PATH=$SQLITE_INSTALL_LOCATION/lib make
$ LD_RUN_PATH=$SQLITE_INSTALL_LOCATION/lib make install
Once you do that you should have a Python version with SQLite3 support installed at $PYTHON_INSTALL_LOCATION/bin/python
Hope this helps!
Disclaimer: I'm not a Mac User, but by common knowledge i give you
this info.
You could follow the next instructions:
Use Homebrew
As this page mention: If you need to upgrade sqlite, you could use Homebrew.
Homebrew implies an aditional "software manager". So you should know how to use it before.
Install it from the source
As this page metion:
Download the sqlite-autoconf package
Compile it and install it:
:
$ tar xvfz sqlite-autoconf-3071502.tar.gz
$ cd sqlite-autoconf-3071502
$ ./configure --prefix=/usr/local
$ make
$ make install
Either Homebrew or Source, verfy it
>>> import sqlite3
>>> sqlite3.version_info
(2, 4, 1)
>>> sqlite3.sqlite_version_info
(3, 6, 11)
>>> from pysqlite2 import dbapi2 as sqlite3
>>> sqlite3.version_info
(2, 5, 5)
>>> sqlite3.sqlite_version_info
(3, 6, 18)
Maybe you need to uninstall previous version of pysqlite. In any way, you should read this answer to understand better the sqlite/python relationship.
https://pip.pypa.io/en/latest/installing.html
python get-pip.py
python [complete path]
python c:\folder\get-pip.py

Installing mysql-python on Centos

I'm trying to get the MySQL-python lib installed on centos 5.5. I ran
sudo yum install MySQL-python
but then when I tried:
import MySQLdb
I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "MySQLdb/__init__.py", line 22, in ?
raise ImportError("this is MySQLdb version %s, but _mysql is version %r" %
ImportError: this is MySQLdb version (1, 2, 3, 'final', 0), \ # added linebreak
but _mysql is version (1, 2, 1, 'final', 1)
any clues on how to fix this?
Step 1 - Install package
# yum install MySQL-python
Loaded plugins: auto-update-debuginfo, langpacks, presto, refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package MySQL-python.i686 0:1.2.3-3.fc15 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
MySQL-python i686 1.2.3-3.fc15 fedora 78 k
Transaction Summary
================================================================================
Install 1 Package(s)
Total download size: 78 k
Installed size: 220 k
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 78 k
MySQL-python-1.2.3-3.fc15.i686.rpm | 78 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : MySQL-python-1.2.3-3.fc15.i686 1/1
Installed:
MySQL-python.i686 0:1.2.3-3.fc15
Complete!
Step 2 - Test working
import MySQLdb
db = MySQLdb.connect("localhost","myusername","mypassword","mydb" )
cursor = db.cursor()
cursor.execute("SELECT VERSION()")
data = cursor.fetchone()
print "Database version : %s " % data
db.close()
Ouput:
Database version : 5.5.20
I have Python 2.7.5, MySQL 5.6 and CentOS 7.1.1503.
For me it worked with the following command:
# pip install mysql-python
Note pre-requisites here:
Install Python pip:
# rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# yum -y update
Reboot the machine (if kernel is also updated)
# yum -y install python-pip
Install Python devel packages:
# yum install python-devel
Install MySQL devel packages:
# yum install mysql-devel
For centos7 I required:
sudo yum install mysql-devel gcc python-pip python-devel
sudo pip install mysql-python
So, gcc and mysql-devel (rather than mysql) were important
You probably did not install MySQL via yum? The version of MySQLDB in the repository is tied to the version of MySQL in the repository. The versions need to match.
Your choices are:
Install the RPM version of MySQL.
Compile MySQLDB to your version of
MySQL.
mysql-python NOT support Python3, you may need:
sudo pip3 install mysqlclient
Also, check this post for more alternatives.

Categories