not able to compile wxpython-cffi on macOS with pypy3 - macos

I'm trying to follow/modify these instructions to get matplotlib compiled on pypy3, but when I try to compile wxpython-cffi with pypy3 build.py dox I get this error:
Traceback (most recent call last):
File "build.py", line 1650, in <module>
main(sys.argv[1:])
File "build.py", line 164, in main
function(options, args)
File "build.py", line 665, in cmd_dox
_doDox('xml')
File "build.py", line 657, in _doDox
pwd = pushDir(posixjoin(wxDir(), 'docs/doxygen'))
File "build.py", line 422, in __init__
os.chdir(newDir)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/user/tmp/docs/doxygen'
The steps I followed are:
installing pypy3 with brew: brew install pypy3
trying to install matplotlib with pip_pypy3 but getting this long error message
trying to install wxpython with pip_pypy3 install wxpython and getting another very long error message
Download wxpython-cffi: hg clone https://bitbucket.org/amauryfa/wxpython-cffi
installing wxWidgets with brew: brew install wxWidgets
which doxygen --> /usr/local/bin/doxygen
export DOXYGEN=/usr/local/bin/doxygen
and finally pypy3 build.py dox which results the error above
changing the line 657 of build.py from pwd = pushDir(posixjoin(wxDir(), 'docs/doxygen')) to pwd = pushDir('/usr/local/bin') results in a completely different error:
Running command: dox
./regen.sh xml
/bin/sh: ./regen.sh: No such file or directory
Command './regen.sh xml' failed with exit code 127.
I would appreciate if you could help me know what is the problem and how I can solve it. the final goal is to get the matplotlib installed on pypy3, so out of the box solutions also would do.
P.S. I'm not sure if my tags are appropriate. I would appreciate if the moderators could let me know if they need to be modified/removed

Matplotlib and PyPy is a known pain point on OSX, we have had multiple reporters but since the PyPy team does not have an OSX developer we cannot fix it on our own. See https://bitbucket.org/pypy/pypy/issues/2327 or any of the other matplotlib issues on the PyPy issue tracker.
It would be great if someone capable of working through this with us would step up and help us fix it, reach out with a response to any of the multiple issues or on IRC at #pypy

Related

Installing pysam for HTSeq - "PackagesNotFoundError: The following packages are not available from current channels:"

I am new to Python, Anaconda, and coding in general. I'm trying to install pysam. I need it to install HTSeq so that I can convert bam files to count files for a class project. Once they are count files, I plan to use edgeR for the rest of the data analysis. I was able to install NumPy without a problem. I've tried multiple codes for installing pysam, so I'm wondering if I'm missing some sort of dependency? Do I need to install samtools or something before I can install pysam?
In addition to tips for installing pysam, I am also open to advice for other methods for converting bam files to count files. Is it possible to download and use HTSeq for this purpose without pysam? Converting the file is the only thing I need to use HTSeq for to complete my class project. Is there another program other than HTSeq that I could use?
I appreciate any advice, and sorry if I'm leaving out any critical information. This is my first big coding project and the first time I've had to ask a stack question.
Thanks!
Here is what I have tried to install pysam:
conda config --add channels r
Warning: 'r' already in 'channels' list, moving to the top
conda config --add channels bioconda
Warning: 'bioconda' already in 'channels' list, moving to the top
conda install pysam
conda install -c bioconda pysam
conda install -c "bioconda/label/cf201901" pysam
For every conda install I get the same output:
Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
pysam
Current channels: a bunch of links here that stack won't let me post To search for alternate channels that may provide the conda package you're looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
```
```
I also tried:
conda config --append channels conda-forge
Warning: 'conda-forge' already in 'channels' list, moving to the bottom
And when I tried the conda install I got the same output as before.
Even though it's not recommended, I also tried to install with pip using:
pip install pysam
Collecting pysam Using cached pysam-0.20.0.tar.gz (4.0 MB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error
python setup.py egg_info did not run successfully. exit code: 1 [24 lines of output] pysam: cython is available - using cythonize if necessary pysam: htslib mode is shared pysam: HTSLIB_CONFIGURE_OPTIONS=None is not recognized as an internal or external command, operable program or batch file. is not recognized as an internal or external command, operable program or batch file. Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "C:\Users\Emily\AppData\Local\Temp\pip-install-q06_8qe9\pysam_31e61bb6d116452f888986de7135a214\setup.py", line 381, in <module> htslib_make_options = run_make_print_config() File "C:\Users\Emily\AppData\Local\Temp\pip-install-q06_8qe9\pysam_31e61bb6d116452f888986de7135a214\setup.py", line 79, in run_make_print_config stdout = subprocess.check_output(["make", "-s", "print-config"]) File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 1420, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified pysam: htslib configure options: None [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
Encountered error while generating package metadata. See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details.
I also restarted my laptop, uninstalled and reinstalled Python and Anaconda. I am using Windows, and working in VS through Anaconda as an administrator.

Problems finding modules after installing SimpleCV 1.3

I have recently installed SimpleCV on Windows 10 from the superpack. Everything went well during the installation, and I was able to successfully run the first example problem in "Practical Computer Vision with SimpleCV" (good book, btw) from within IDLE. Here's the code:
from SimpleCV import Camera, Display, Image
cam = Camera()
display = Display()
img = cam.getImage()
img.save(display)
Simple enough, and it worked fine. Where I ran into problems was when I tried to start up the SimpleCV console. First of all, no link was created on the Windows desktop, and there was nothing for SimpleCV on the Start menu. So, I tried the other methods listed in the book. First, from the console, I tried to run it as a Python module:
C:\User> python -m SimpleCV.init
And what I got back was:
ERROR:
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\lib\site-packages\SimpleCV\__init__.py", line 18 in <module>
from SimpleCV.Shell import *
File "C:\Python27\;ib\site-packages\SimpleCV\Shell\__init__.py", line 1, in <module>
from Shell import *
File "C:\Python27\lib\site-packages\SimpleCV\Shell\Shell.py", line 54, in <module>
raise(e)
ImportError: No module named IPython
Next, I tried the listed alternative: just starting python and importing and executing the Shell. Entering:
>>> from SimpleCV import Shell
resulted in the same error as above.
I also tried installing ipython by running pip. But, it looks like pip didn't get installed either.
So, what environmental variable did the installation program not set correctly? Just so you know, I posted this same question on the SimpleCV site, but have not received a response as of yet.
--- 23 Dec 2015
Chipping away at this. Read the banner on setuputils install. Ran Python27\Scripts\easy_install.exe. Can now call pip. However, entering this at the command line:
C:\Users> pip install ipython
gives this error:
C:\Python27\lib\site--packages\pip-7.1.2-py2.7.egg\pip\_vendor\requests\packages\urllib3\util\ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cuase certain SSL connections to fail. For more information, see...
So, I'm making progress. Any suggestions?
Have you tried to install ipython from source code?
$ tar -xzf ipython.tar.gz
$ cd ipython
$ python setup.py install
See https://ipython.org/ipython-doc/3/install/install.html
There are a lot of requirements more. I recommend the SimpleCV's github repository instructions https://github.com/sightmachine/SimpleCV#windows-8

Using cx_freeze with PyQT5 and Python 3 on MacOSX

I'm trying to use cx_freeze 4.3.3 on a MacOS running 10.9.2 on a very simple PyQt5 script with Python 3.3.
No errors are returned and the .app is output. However when running the .app from terminal I obtain the error:
LSOpenURLsWithRole() failed with error -10810
which according to Apple's documentation is "Unknown Error".
The very simple code I try to run (PyQt5app.py) is:
import sys
from PyQt5.QtWidgets import QApplication, QDialog
app = QApplication(sys.argv)
form = QDialog()
form.show()
app.exec_()
The file setup.py is:
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
options = {
'build_exe': {
'excludes': ['Tkinter'] # Sometimes a little finetuning is needed
}
}
executables = [
Executable('PyQt5app.py', base=base)
]
setup(name='PyQt5app',
version='0.1',
description='Sample PyQt5 GUI',
executables=executables,
options=options
)
and when running I call:
sudo python cx_freeze bdist_mac
obtaining this log : http://pastebin.com/VBxyyBRn
with app returning error above.
So, reading around I see it might be a problem related to including qt files in the app (or at least this was the issue on PyQt4) so I try specifying the qt-menu-nib directory:
sudo python setup.py bdist_mac --qt-menu-nib=/Users/franco/Qt5.2.1/5.2.1/clang_64/plugins/platforms/
obtaining this log: http://pastebin.com/TpRdrSmT
and the same not working error.
If I run the app from PyQt5app.app/Contents/MacOS/PyQt5app I get a lot of bootstrap errors:
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/cx_Freeze-4.3.3-py3.3-macosx-10.9-x86_64.egg/cx_Freeze/initscripts/Console.py", line 27, in <module>
exec(code, m.__dict__)
File "PyQt5app.py", line 5, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1565, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1532, in _find_and_load_unlocked
loader.load_module(name)
File "ExtensionLoader_PyQt5_QtWidgets.py", line 22, in <module>
File "ExtensionLoader_PyQt5_QtWidgets.py", line 14, in __bootstrap__
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1565, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1532, in _find_and_load_unlocked
loader.load_module(name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 584, in _check_name_wrapper
return method(self, name, *args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 495, in set_package_wrapper
module = fxn(*args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 508, in set_loader_wrapper
module = fxn(self, *args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 1132, in load_module
fullname, self.path)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py", line 313, in _call_with_frames_removed
return f(*args, **kwds)
SystemError: initialization of sip raised unreported exception
Needless to say the script works fine when launching from terminal:
python PyQt5app.py
I most certainly am doing something wrong, so please, can anybody help me?
So, after long fighting here is the issue: libzmq .
I installed libzmq and specified the --qt-menu-nib option and the simple example above runs in both:
sudo python setup.py build
and
sudo python setup.py bdist_mac
Step by step instructions:
I used mac ports for most of my python33 packages so I sticked to it for the rest.
Libzmq is not available on macports but its dependencies are.
So:
1) install libtool, autoconf, automake:
sudo port install libtool
sudo port install autoconf
sudo port install automake
2) grab the latest version of libzmq from https://github.com/zeromq/libzmq ( I downloaded the ZIP for sake of order ) and unzip/navigate to the folder
/libzmq-master
now the instructions provided in the INSTALL document in the folder are pretty clear, if you installed all the dependencies then you will be fine.
run:
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
3) download the latest cx_freeze from https://bitbucket.org/anthony_tuininga/cx_freeze/downloads then unzip/untar navigate to folder and run:
sudo python setup.py build
sudo python setup.py install
now when compiling code for MacOSX that uses Python3.3 and PyQt5 you can run:
sudo python setup.py build
then navigate in the build folder and run the program as:
./nameoftheprogram
once you made sure this work then build the app or dmg (as you prefer) with:
sudo python setup.py bdist_mac --qt-menu-nib=/Users/username/Qt5.2.1/5.2.1/clang_64/plugins/platforms/
where the path is the path to your Qt5 installation. If I don't use the --qt-menu-nib option the app crashes on startup whereas the build works fine.
Hope this will help someone in the future.
I got the same error and recompiling with the latest version of ZMQ (4.0.4) did not solve the issue.
However, by looking in the messages of the /Applications/Utilities/Console.app program, I could see that an extra command line option was given to my Python program. This command line option always started with -psn_0_ followed by a number. Apparently psn stands for Process Serial Number (see: http://hintsforums.macworld.com/showthread.php?t=11978).
My program uses the argparse package to parse the command line arguments and exited with an error because it didn't recognized the -psn option. I now filter it out before parsing with argparse and this solved my problem.

HTTPLIB2 Error installing python-twitter on mac osx

Hello I am trying to install python-twitter and one of the dependencies HTTPLIB2 is giving me a lot of problems. I have searched the internet up and down but maybe I do not know what the right key words are. Here is the problem.
I am installing python-twitter. I install the requirements either by "pip install -r requirements.txt" or doing them one by one through for example "pip install httplib2". Then I run "python setup.py install". It's happy but then "python setup.py test" fails as followed with an error on import HTTPLIB2.
python setup.py test
running test
running egg_info
writing requirements to python_twitter.egg-info/requires.txt
writing python_twitter.egg-info/PKG-INFO
writing top-level names to python_twitter.egg-info/top_level.txt
writing dependency_links to python_twitter.egg-info/dependency_links.txt
reading manifest file 'python_twitter.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching '.DS_Store'
writing manifest file 'python_twitter.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 73, in <module>
Main()
File "setup.py", line 66, in Main
setuptools.setup(**METADATA)
File
....
<deleted these parts to save space>
module = __import__('.'.join(parts_copy))
File "/Users/ME/Downloads/python-twitter-1.0/twitter_test.py", line 30, in <module>
import twitter
File "/Users/ME/Downloads/python-twitter-1.0/twitter.py", line 65, in <module>
import oauth2 as oauth
File "/usr/local/lib/python2.7/site-packages/oauth2/__init__.py", line 32, in <module>
import httplib2
File "/usr/local/lib/python2.7/site-packages/httplib2/__init__.py", line 347
print('%s:' % h, end=' ', file=self._fp)
^
SyntaxError: invalid syntax
But I thought the print error was an incompatibility between python 2 and 3. Why am I getting this while I clearly have python 2.7 (I checked and uninstalled and reinstalled HTTPLIB2).
Thanks much for your help
i had a same issue. It seems to be python2.7 and 3.x version conflict issue and resolved by
python2.7 -m pip install -t lib/ -r requirements.txt
Just in case, this happens when you install httplib2 with a python3 version of pip and then execute it with python2.
This happens for example when creating manually an environment with:
pip install -t lib/ -r requirements
As it happens when creating an AppEngine standard environment vendor folder.
This happens because contrary to most of the libraries, httplib2 has completely different versions for python2 and python3.

MySQL-Python with PyPy

MySQL-Python (MySQLdb) is known to work with PyPy. How do you make it work?
I tried downloading it and installing:
C:\dev\Installs\MySQL-python\MySQL-python-1.2.3>pypy setup.py install
Traceback (most recent call last):
File "app_main.py", line 51, in run_toplevel
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "C:\dev\Installs\MySQL-python\MySQL-python-1.2.3\setup_windows.py", line 7, in get_config
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key'])
WindowsError: [Error 2] The system cannot find the file specified.
Then I tried to download the ctypes implementation which seemed to have installed ok, however trying to use it gave:
...
File "C:\pypy-1.7\site-packages\django\db\backends\mysql\base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: Can't find a libmysqlclient
I'm at a loss at this point. How do I make it work
Regarding your second error with mysql-ctypes, the answer is that the line
ctypes.util.find_library('mysqlclient')
can't find the library on windows. Changing it to:
ctypes.util.find_library('mysqlclient.lib')
works on my system - but that only gets you to the next error (windows error 193) on my system.
you're right, the original MySQLdb is known to not work on PyPy.
I never tried to install mysql-ctypes on a windows maschine as I do not have one, but do you have libmysqlclient installed in your PATH?
If so, you may try my (sadly not yet merged) fork on https://github.com/EnTeQuAk/mysql-ctypes which has support for a bit more versions of libmysqlclient.
I had no issues with the MySQLdb package in pypy after installing it using pip.
You can find instructions for installing pip for pypy in the second section of the following link: http://doc.pypy.org/en/latest/getting-started.html#installing-pypy
Once you have pip installed, it's just a matter of running
pip install MySQL-python

Resources