Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib error during B.importGenome in pip version #31

Closed
erscott opened this issue Jul 4, 2017 · 3 comments
Closed

urllib error during B.importGenome in pip version #31

erscott opened this issue Jul 4, 2017 · 3 comments

Comments

@erscott
Copy link

erscott commented Jul 4, 2017

The pip version of the package generates an FTP error,
"IOError: [Errno ftr error] 200 Switching to Binary Mode", during bootstrap import of at least Human.GRCh37.75.tar.gz.

The traceback indicates line 46 of importation/Genomes.py may be causing the issue.
_getFile function:
line 46: urllib.urlretrieve (fil, finalFile)

The GitHub bloody branch replaces line 46 of importation/Genomes.py with an iterator and seems to resolve this issue.

You might want to update the pip version of pyGeno. Thanks for making this package available under Apache 2.0!

TRACEBACK:

IOError Traceback (most recent call last)
in ()
----> 1 get_ipython().magic(u'time B.importGenome("Human.GRCh37.75.tar.gz")')

/opt/conda/envs/python2/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2156 magic_name, _, magic_arg_s = arg_s.partition(' ')
2157 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2158 return self.run_line_magic(magic_name, magic_arg_s)
2159
2160 #-------------------------------------------------------------------------

/opt/conda/envs/python2/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2077 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2078 with self.builtin_trap:
-> 2079 result = fn(*args,**kwargs)
2080 return result
2081

in time(self, line, cell, local_ns)

/opt/conda/envs/python2/lib/python2.7/site-packages/IPython/core/magic.pyc in (f, *a, **k)
186 # but it's overkill for just that one bit of state.
187 def magic_deco(arg):
--> 188 call = lambda f, *a, **k: f(*a, **k)
189
190 if callable(arg):

/opt/conda/envs/python2/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns)
1179 if mode=='eval':
1180 st = clock2()
-> 1181 out = eval(code, glob, local_ns)
1182 end = clock2()
1183 else:

in ()

/opt/conda/envs/python2/lib/python2.7/site-packages/pyGeno/bootstrap.pyc in importGenome(name, batchSize)
100 """Import a genome shipped with pyGeno. Most of the datawraps only contain URLs towards data provided by third parties."""
101 path = os.path.join(this_dir, "bootstrap_data", "genomes/" + name)
--> 102 PG.importGenome(path, batchSize)
103
104 def importSNPs(name) :

/opt/conda/envs/python2/lib/python2.7/site-packages/pyGeno/importation/Genomes.pyc in importGenome(packageFile, batchSize, verbose)
149 raise KeyError("The directory %s already exists, Please call deleteGenome() first if you want to reinstall" % seqTargetDir)
150
--> 151 gtfFile = _getFile(parser.get('gene_set', 'gtf'), packageDir)
152
153 chromosomesFiles = {}

/opt/conda/envs/python2/lib/python2.7/site-packages/pyGeno/importation/Genomes.pyc in _getFile(fil, directory)
44 printf("Downloading file: %s..." % fil)
45 finalFile = os.path.normpath('%s/%s' %(directory, fil.split('/')[-1]))
---> 46 urllib.urlretrieve (fil, finalFile)
47 printf('done.')
48 else :

/opt/conda/envs/python2/lib/python2.7/urllib.pyc in urlretrieve(url, filename, reporthook, data, context)
96 else:
97 opener = _urlopener
---> 98 return opener.retrieve(url, filename, reporthook, data)
99 def urlcleanup():
100 if _urlopener:

/opt/conda/envs/python2/lib/python2.7/urllib.pyc in retrieve(self, url, filename, reporthook, data)
243 except IOError:
244 pass
--> 245 fp = self.open(url, data)
246 try:
247 headers = fp.info()

/opt/conda/envs/python2/lib/python2.7/urllib.pyc in open(self, fullurl, data)
211 try:
212 if data is None:
--> 213 return getattr(self, name)(url)
214 else:
215 return getattr(self, name)(url, data)

/opt/conda/envs/python2/lib/python2.7/urllib.pyc in open_ftp(self, url)
556 value in ('a', 'A', 'i', 'I', 'd', 'D'):
557 type = value.upper()
--> 558 (fp, retrlen) = self.ftpcache[key].retrfile(file, type)
559 mtype = mimetypes.guess_type("ftp:" + url)[0]
560 headers = ""

/opt/conda/envs/python2/lib/python2.7/urllib.pyc in retrfile(self, file, type)
904 try:
905 cmd = 'RETR ' + file
--> 906 conn, retrlen = self.ftp.ntransfercmd(cmd)
907 except ftplib.error_perm, reason:
908 if str(reason)[:3] != '550':

/opt/conda/envs/python2/lib/python2.7/ftplib.pyc in ntransfercmd(self, cmd, rest)
332 size = None
333 if self.passiveserver:
--> 334 host, port = self.makepasv()
335 conn = socket.create_connection((host, port), self.timeout)
336 try:

/opt/conda/envs/python2/lib/python2.7/ftplib.pyc in makepasv(self)
310 def makepasv(self):
311 if self.af == socket.AF_INET:
--> 312 host, port = parse227(self.sendcmd('PASV'))
313 else:
314 host, port = parse229(self.sendcmd('EPSV'), self.sock.getpeername())

/opt/conda/envs/python2/lib/python2.7/ftplib.pyc in parse227(resp)
828
829 if resp[:3] != '227':
--> 830 raise error_reply, resp
831 global _227_re
832 if _227_re is None:

IOError: [Errno ftp error] 200 Switching to Binary mode.

@tariqdaouda
Copy link
Owner

Thank you. I was unable to push the current version of pyGeno to PyPi. I might be pulling pyGeno from PyPi for the next versions.

Could you try: pip install git+https://www.github.com/tariqdaouda/pyGeno ?

This version works for me.

@iranmdl
Copy link

iranmdl commented Sep 13, 2017

Hi! I'm getting this error:

pip install git+https://www.github.com/tariqdaouda/pyGeno
Collecting git+https://www.github.com/tariqdaouda/pyGeno
  Cloning https://www.github.com/tariqdaouda/pyGeno to /tmp/pip-LC_Z2e-build
Collecting rabaDB>=1.0.4 (from pyGeno==1.3.1)
  Could not find a version that satisfies the requirement rabaDB>=1.0.4 (from pyGeno==1.3.1) (from versions: 1.0.1, 1.0.2)
No matching distribution found for rabaDB>=1.0.4 (from pyGeno==1.3.1)

@tariqdaouda
Copy link
Owner

First, can you do: pip install git+https://www.github.com/tariqdaouda/rabaDB ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants