[Biopython] install from source: is this an issue?

Peter Cock p.j.a.cock at googlemail.com
Fri Oct 21 08:40:31 EDT 2022


Iddo has opened an issue on this:

https://github.com/biopython/biopython/issues/4140

He's got bitten by a recent change (not yet in a release) which missed
updating the docs:

https://github.com/biopython/biopython/pull/3912

Prior to that change, run_tests.py did some path magic to use the
build/ folder's compiled C extensions so that you could run the tests
without having installed Biopython.

There is a documentation update PR here which needs looking at:

https://github.com/biopython/biopython/pull/3937

Peter

On Thu, Oct 20, 2022 at 8:17 AM Markus Piotrowski
<Markus.Piotrowski at ruhr-uni-bochum.de> wrote:
>
> Dear Iddo,
>
> After reading here:
>
> https://docs.python.org/3/install/
>
> I would assume that your built Biopython stuff is in a "build" subfolder (including the C extensions),  but you are running the test from the source folder (biopython-master). Could this be?
>
> Best
> Markus
>
>
>
> Am 20.10.2022 um 08:41 schrieb Markus Piotrowski:
>
> This may be a naive question, since I'm not very familiar with installing from source, but does "build" compile the C extensions or is this something that happens during "install"? In the first case you would be missing the compiled C-extension, leading to the described import error.
>
> Best
> Markus
>
> Am 20.10.2022 um 01:58 schrieb Iddo Friedberg:
>
> Hi,
>
> Thank you for your answer, Michiel.
>
> So I'm confused as to what I am doing wrong. I downloaded the zip , unzipped, changed to the biopython-master directory, and ran
>
> python setup.py build
> (this seems to be concluding fine)
>
> python setup.py test
>
> And the first error line (of many) is:
> /home/idoerg/Downloads/biopython-master/Bio/__init__.py:138: BiopythonWarning: You may be importing Biopython from inside the source tree.
> This is bad practice and might lead to downstream issues. In particular, you might encounter ImportErrors due to missing compiled C extensions.
> We recommend that you try running your code from outside the source tree.
> If you are outside the source tree then you have a setup.py file in an unexpected directory: /home/idoerg/Downloads/biopython-master
>
> Thanks,
>
> Iddo
>
> --
> Sent from a machine that promotes typos
>
> On Wed, Oct 19, 2022, 17:15 Michiel de Hoon <mjldehoon at yahoo.com> wrote:
>>
>> Hi Iddo,
>>
>>
>> > The first error "BiopythonWarning: You may be importing Biopython from inside the source tree."
>> > Is that something I can ignore,
>>
>> No; it is causing the import error.
>>
>> Best,
>> -Michiel
>>
>> On Thursday, October 20, 2022 at 01:43:28 AM GMT+9, Iddo Friedberg <idoerg at gmail.com> wrote:
>>
>>
>> Hi,
>>
>> I'm trying to install biopython from source, since release 1.79 does not work with the newest Swissprot FT records. Looking at the source of SwissProt/__init__.py in github this issue seems to be fixed and hopefully release 1.80 this will work again.
>>
>> However, I am encountering the following problem when trying to test:
>>
>>
>> idoerg at IddoWS:~/soft/biopython$ python setup.py test
>> running test
>> Python version: 3.7.5 (default, Dec  9 2021, 17:04:37)
>> [GCC 8.4.0]
>> Operating system: posix linux
>> /home/idoerg/soft/biopython/Bio/__init__.py:146: BiopythonWarning: You may be importing Biopython from inside the source tree. This is bad practice and might lead to downstream issues. In particular, you might encounter ImportErrors due to missing compiled C extensions. We recommend that you try running your code from outside the source tree. If you are outside the source tree then you have a setup.py file in an unexpected directory: /home/idoerg/soft/biopython
>>   BiopythonWarning,
>> test_Ace ... ok
>> test_Affy ... ok
>> test_AlignIO ... loading tests failed:
>> Failed to import test module: test_AlignIO
>> Traceback (most recent call last):
>>   File "/usr/lib/python3.7/unittest/loader.py", line 154, in loadTestsFromName
>>     module = __import__(module_name)
>>   File "/home/idoerg/soft/biopython/Tests/test_AlignIO.py", line 11, in <module>
>>     from Bio import AlignIO
>>   File "/home/idoerg/soft/biopython/Bio/AlignIO/__init__.py", line 140, in <module>
>>     from Bio.Align import MultipleSeqAlignment
>>   File "/home/idoerg/soft/biopython/Bio/Align/__init__.py", line 34, in <module>
>>     from Bio.Align import _aligners
>> ImportError: cannot import name '_aligners' from 'Bio.Align' (/home/idoerg/soft/biopython/Bio/Align/__init__.py)
>>
>> Previous iterations of the "_aligners" import error error in the biopython github were attributed to conflicting python versions. This may be the case here, but before I kill all my anaconda stuff, I just wanted to make sure that  I'm actually running the test correctly.  The first error "BiopythonWarning: You may be importing Biopython from inside the source tree."
>>
>> Is that something I can ignore, or am I doing yet another thing wrong?
>>
>> Thanks,
>>
>> Iddo
>>
>> --
>> Iddo Friedberg
>> http://iddo-friedberg.net/contact.html
>> ++++++++++[>+++>++++++>++++++++>++++++++++>+++++++++++<<<<<-]>>>>++++.>
>> ++++++..----.<<<<++++++++++++++++++++++++++++.-----------..>>>+.-----.
>> .>-.<<<<--.>>>++.>+++.<+++.----.-.<++++++++++++++++++.>+.>.<++.<<<+.>>
>> >>----.<--.>++++++.<<<<------------------------------------.
>> _______________________________________________
>> Biopython mailing list  -  Biopython at biopython.org
>> https://mailman.open-bio.org/mailman/listinfo/biopython
>
>
> _______________________________________________
> Biopython mailing list  -  Biopython at biopython.org
> https://mailman.open-bio.org/mailman/listinfo/biopython
>
>
> --
> _________________________________
> Dr. Markus Piotrowski
> Privatdozent/Akademischer Rat
> Lehrstuhl für Molekulargenetik und Physiologie der Pflanzen
> ND 3/49
> Universitätsstr. 150
> 44801 Bochum
>
> Tel. xx49-(0)234-3224290
> Fax. xx49-(0)234-3214187
>
> https://www.ruhr-uni-bochum.de/pflaphy/Seiten_dt/Piotrowski_d.html
> http://homepage.ruhr-uni-bochum.de/Markus.Piotrowski/Index.html
>
>
> _______________________________________________
> Biopython mailing list  -  Biopython at biopython.org
> https://mailman.open-bio.org/mailman/listinfo/biopython
>
>
> --
> _________________________________
> Dr. Markus Piotrowski
> Privatdozent/Akademischer Rat
> Lehrstuhl für Molekulargenetik und Physiologie der Pflanzen
> ND 3/49
> Universitätsstr. 150
> 44801 Bochum
>
> Tel. xx49-(0)234-3224290
> Fax. xx49-(0)234-3214187
>
> https://www.ruhr-uni-bochum.de/pflaphy/Seiten_dt/Piotrowski_d.html
> http://homepage.ruhr-uni-bochum.de/Markus.Piotrowski/Index.html
>
> _______________________________________________
> Biopython mailing list  -  Biopython at biopython.org
> https://mailman.open-bio.org/mailman/listinfo/biopython


More information about the Biopython mailing list