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

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.

Related

not able to compile wxpython-cffi on macOS with pypy3

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

Why does pip freeze geneate package_name=0.0.0

I used pip freeze to pull out every dependency of my virtualenv to use this environment in other place so that I got the requirements.txt like the below.
certifi==2017.7.27.1
chardet==3.0.4
get==0.0.0
gevent==1.2.2
greenlet==0.4.12
idna==2.6
numpy==1.13.3
pandas==0.20.3
post==0.0.0
psycopg2==2.7.3.1
public==0.0.0
python-dateutil==2.6.1
pytz==2017.2
query-string==0.0.0
request==0.0.0
requests==2.18.4
setupfiles==0.0.50
six==1.11.0
sqlalchemy==1.1.14
urllib3==1.22
I used this requirements in other computer but whenever I tried running pip install -r requirements.txt I got the error like the following.
$ pip install -r requirements.txt
Requirement already satisfied: certifi==2017.7.27.1 in d:\workspace\juice-project\venv\lib\site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: chardet==3.0.4 in d:\workspace\juice-project\venv\lib\site-packages (from -r requirements.txt (line 2))
Collecting get==0.0.0 (from -r requirements.txt (line 3))
Using cached get-0.0.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "d:\workspace\juice-project\venv\lib\tokenize.py", line 452, in open
buffer = _builtin_open(filename, 'rb')
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\verys\\AppData\\Local\\Temp\\pip-build-1cd8yl0b\\get\\setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\verys\AppData\Local\Temp\pip-build-1cd8yl0b\get\
I thought it is caused by privilege of window user so that I spent a lots of time to solve this problem with other reason. I got so annoyed because of the bug. Could you explain why this unused things generate and why this error can be like this?
Because these libraries — get, request (of the same author) — are written improperly. It is not your problem, it is theirs. You are NOT able to solve this from your side.
Take a look at their setup.py:
kwargs = dict()
# known-issues:
# pip running `python setup.py egg_info` before installation:
# 1) pip checks metadata name pip/req/req_install.py:run_egg_info()
# 2) pip attempts to discover all of the dependencies before installation
name = os.path.basename(os.getcwd()).split(".")[0].lower()
path = os.path.join(os.getcwd(), "requirements.txt")
if os.path.exists(path) and os.path.isfile(path):
kwargs["install_requires"] = open(path).read().splitlines()
setup(name=name, **kwargs)
It does not contain version=... kwarg. Sadly so, this library will be always of version 0.0.0, which is the default of this setupfiles self-made library (see here).
PS: Do you really want to use a library of that quality? Why not just copy thise few lines to your code? This is not nodejs world, where it is good to use nano-modules like this.
UPD: I've just noticed that setup() is not from setuptools, but from setupfiles, also of the same author, and it is declared to guess the values of the keys. So, maybe it was supposed to work. But is broken because of this non-standard usage of the setup conventions.
I wouldn't say it is a best or even good practice to replace setuptools this way. And it is not safe either — the malicious library authors can just inject any arbitrary code to be executed on your workstations/servers. Especially that hacky.
Still, in the example it requires a version=... argument, which is missing in those libraries.

pip install --user error under OS X (virtualenv doesn't fix it)

I used to install python (2.7.6) packages using sudo pip install [...] until I recently decided that this was a bad idea and I should use: pip install --user [...] instead.
Since I am using Mac OS X (10.10.3), my python modules had been installed into /Library/Python/2.7/site-packages. Now, with the --user option enabled, they are being installed into: /Users/USER/Library/Python/2.7/lib/python/site-packages
I have since moved all packages (including pip/setuptools) into this destination, adjusted my $PYTHONPATH and changed the file ownership to my local user. I expected that I would now be able to call pip install --user [..] and everything should go smoothly.
Unfortunately, this is not the case. For any pip install (or pip install --upgrade) command I receive the same error (below). The same is true when using a virtualenv - the same error shows up and I have no clue why.
However, everything does work "fine", when I use sudo pip install --user, which is why I assume that it is somehow related to a file-permission error I can not see. (It's not exactly fine, as the newly installed package will be in the right location, but all files are owned by root.)
Any idea what I am doing wrong or how to debug this?
pip install --upgrade --user tornado
Collecting tornado
Using cached tornado-4.1.tar.gz
Exception:
Traceback (most recent call last):
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/commands/install.py", line 280, in run
requirement_set.prepare_files(finder)
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 317, in prepare_files
functools.partial(self._prepare_file, finder))
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 304, in _walk_req_to_install
more_reqs = handler(req_to_install)
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 483, in _prepare_file
abstract_dist.prep_for_dist()
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 123, in prep_for_dist
self.req_to_install.run_egg_info()
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_install.py", line 368, in run_egg_info
self.setup_py, self.name,
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/pip/req/req_install.py", line 339, in setup_py
import setuptools # noqa
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extension import Extension
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/setuptools/extension.py", line 8, in <module>
from .dist import _get_unpatched
File "/Users/USER/Library/Python/2.7/lib/python/site-packages/setuptools/dist.py", line 21, in <module>
packaging = pkg_resources.packaging
AttributeError: 'module' object has no attribute 'packaging'
I also checked the location of pkg_resources and deleted pkg_resources.pyc, which is located in /usr/local/lib/python2.7/site-packages for some reason, but it didn't change anything. (My local user also has full access rights in this location.)
[UPDATE:]
For some reason I was able to install virtualenv without root (pip install --user virtualenv), but all other packages I tried still fail. Also, if I switch to a new virtual environment, I still receive the same error. I am now thinking this is related to my $PYTHONPATH variable, which appears to not be updated for my virtualenv, but I haven't found the real solution, yet.
Alright, so I found the actual problem and solution. My $PYTHONPATH contained an invalid directory. I setup my $PYTHONPATH a long time ago and wrote it into a .bashrc (or more accurately .bash_profile) script.
pip was probably looking through all directories in $PYTHONPATH, although I don't know what it is doing in each of them that causes the above error, but removing the invalid directory fixed my problems.
I also now highly recommend to just use virtualenv instead of a static setup.

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