Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

When cpan returns the dreaded "won't install without force"

by Lady_Aleena (Priest)
on Mar 17, 2013 at 22:25 UTC ( [id://1023945]=perlquestion: print w/replies, xml ) Need Help??

Lady_Aleena has asked for the wisdom of the Perl Monks concerning the following question:

Lately I have been trying to install a lot of modules with cpan, and a lot of them are coming back with won't install without force (the last was DateTime today). For those with few tests which do not scroll my screen, copying the test data and Test Summary Report is easy; but for others which have a lot of tests, it is difficult to get everything from the command prompt window. I was thinking it would be nice if I could have the text printed to my screen also printed to a file, especially when the exit value is 8. I then got thinking, it would be nice to be able to immediately report the bug (and attach the aforementioned file) for all modules with exit value 8. I scanned both cpan and CPAN and have not found a way to print to screen and file.

Have a cookie and a very nice day!
Lady Aleena

Replies are listed 'Best First'.
Re: When cpan returns the dreaded "won't install without force"
by tobyink (Canon) on Mar 17, 2013 at 23:20 UTC

    You could try using App::cpanminus instead of the default CPAN client. It logs everything to file by default.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
Re: When cpan returns the dreaded "won't install without force"
by dasgar (Priest) on Mar 18, 2013 at 00:23 UTC

    Are you on Windows? If so, the following should work from a command prompt:

    cpan install IO::Tty 1> install_test.txt 2>&1

    That's basically piping STDERR to STDOUT and then STDOUT to a file (install_test.txt). However, you won't see the output on the screen at the same time.

    If you have PowerShell installed and really want to display messages and send them to a file, you can use the tee-object cmdlet like the following:

    cpan install IO::Tty 2>&1 | Tee-Object -FilePath C:\perl_stuff\install_test2.txt

    Again, the "2>&1" is piping STDERR to STDOUT and then the tee-object is sending the output to STDOUT and a file at the same time.

      Yes dasgar, I am using Windows XP SP3. I was hoping to get away from the command line and maybe write something in a script where I could dump several modules into a list and just run the script, maybe before I go to bed. I would have more control with a script over with the command line. Trust me, doing anything on the command line on a Windows machine is a pain. Here is a non-working untested beginnings of an idea.

      use strict; use warnings; use CPAN; my $CPAN = CPAN->new(); for my $module (@modules) { my $install = $CPAN->install($module); my $file = "module-name-with-hyphens.txt"; open(my $fh, '>', $file) or die $!; print $fh $install; }

      I am not sure the above will do what I want, but it is the general direction I am leaning toward.

      Have a cookie and a very nice day!
      Lady Aleena

        "Trust me, doing anything on the command line on a Windows machine is a pain."

        How so?

Re: When cpan returns the dreaded "won't install without force"
by Corion (Patriarch) on Mar 17, 2013 at 22:34 UTC

    Please don't blindly go reporting bugs.

    Most likely, the last output of cpan when trying to install a module is Won't install without force if a test before that failed. So please go look at the bug reports and CPAN Tester status of the module to see whether others already have reported that bug/test failure. Also, please check whether the test failure is really in the module you're trying to install, or whether it is with some module further upstream.

      Hello Corion...the idea to upload a bug report is something I came up with while typing the idea into the textarea. I had not thought the idea through. I do check new, open, and resolved issues before reporting a bug. If the same bug is already reported, I usually just tack my name onto the original bug report.

      The only thing I know about installing modules is I must type cpan Module::Name at the command prompt. I do not know how to read the output. I have only gotten as far as writing .pm files, since none of my work is really sharable or possibly interesting enough to be CPAN worthy. Tests are still a complete mystery to me. The last time I looked at one of the Test modules, I got lost and left it alone. I have not written a module yet which I could automate any of the testing. I have to eyeball everything. So when it comes to module tests during installation, I have not a clue what to look for in the results.

      I promise to be as good a girl as I can be when reporting bugs when I get won't install without force.

      Have a cookie and a very nice day!
      Lady Aleena

        "The only thing I know about installing modules is I must type cpan Module::Name at the command prompt. I do not know how to read the output."

        You know, you could spend time learning how to do this. For the most part the output is fairly self explanitory. An exampel of something you don't understand would be required to advise further, but usually a google search would find the solution for you.

Re: When cpan returns the dreaded "won't install without force"
by Jenda (Abbot) on Mar 18, 2013 at 13:23 UTC

    You can set not only the size of the command prompt window, but also the size of the screen "buffer". Rightclick the title bar of the command prompt window, select Defaults and set the Screen Buffer Size / Height to a big enough value. You will then be able to scroll back through the output. I've got mine set to 5000 with no problems.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

      Jenda, I have set my buffer to the highest setting Windows XP SP3 will allow. I need an unlimited buffer, but more importantly I need more fine tuned control on selecting text in the command prompt window. Currently to select text, I have to right click, then position the cursor where I want my selection to start, then hold the left mouse key down as I select the text. It is okay when all the lines I want are currently visible, however, if the beginning is two or more screens full upwards, my right pointer finger gets tired holding the left mouse button down while I try to get everything in the select field. I have yet to find keyboard controls for the selecting of text at the command prompt. So, I would prefer to have a text file where I have finer control over what I select to copy then paste into a bug report. Another thing, even if my command prompt window were full screen, some text still inevitably be out of view to the right.

      Even standard error messages scroll off to the right. Instead of telling me what's wrong, then the line number, THEN the file name plus path (which I most likely already know); the error messages always put the line number on the end of the error message string which I have to right scroll to read.

      With command lines being so long in Windows command prompt, I do as little as possible there. Example below.

      C:\Documents and Settings\me\My Documents\fantasy\working\Role_playing +\Player_characters>

      Working in the above directory gives me only 49 characters before scrolling right. Not much room left to do anything which does not scroll to the right.

      Have a cookie and a very nice day!
      Lady Aleena

        You can customize the command prompt in Windows. You might like to try:

        set PROMPT=$G

        Note: there is a trailing space on that command - not easily seen.

        Try help PROMPT for more options (at least in Windows 7, I don't have access to XP to see that it works there)

Re: When cpan returns the dreaded "won't install without force"
by Intrepid (Deacon) on Mar 18, 2013 at 04:35 UTC

    The OP wrote

    Lately I have been trying to install a lot of modules with cpan [...] For those with few tests which do not scroll my screen, copying the test data and Test Summary Report is easy; but for others which have a lot of tests, it is difficult to get everything from the command prompt window.
    I was thinking it would be nice if I could have the text printed to my screen also printed to a file [...]

    The OP's question was not fully addressed by any answers yet given.

    Oops, am I stepping on toes?

    Do I care? I seem not to.

    There are really 3 issues being offered here.

    1. Many tests are failing for this user.
    2. The user is encountering physical difficulty with locating the real (meaningful) content of console output text pertaining to the failures.
    3. The user had a secondary thought that it would be a convenience if test failures were sent in automatically.

    The last issue is the one that was apparently found "interesting to answer" by other users (or pseudo-users). I don't need to address it.

    The first issue was barely addressed. It was addressed by an unproven assumption, to the extent that it was addressed at all. That was by a pseudo-user. The contention was that "prerequisite modules were not found." I don't know who this crackpot is, but frankly, he's lowering the quality of information on perlmonks. He seems to have lots of opinions and lots of time to post to Perlmonks. The lack of genuine knowledgability, the absence of rigorous evidence ("In the absence of evidence, opinion is indistinguishable from prejudice"), the style of expression, all suggest to me that this frequently seen pseudo-user is all one guy. I'd like to now suggest to him, having tried to be more thorough in addressing him previously, that he just get lost.

    Is the OP using a MS Whyyndwoes paltform? Being a Whyyndoes sufferer myself, I know for a fact that test failures are more common on these M$ platforms.

    The second point is a matter of real interest to people who truly want to help. The scrolling of output produced by testing can be a problem. Adjustments to the console or terminal emulator being used can help. First, make sure that one has enough "scroll buffer" set to allow scrolling back through a large number of screenfuls. Second, invest the time in installing and learning one of the replacements for the native MSW console application (the CMD.exe box). Several decent alternatives exist. GIYF.

    Contributors to CPAN have done a lot to make test output cleaner - easier to systematically write test suites that produce output that is consistent from module to module. Props, to the folks who develop TAP. Nevertheless, it is an acquired skill to read test output well and see what is really meaningful. A log file helps a lot. I personally use cpanp, the CPANPLUS (CPAN++) client. It generates logs.

      ... I personally use cpanp, the CPANPLUS (CPAN++) client. It generates logs.

      And then what?

      So instead of responding to nodes you have an issue with, you'll rant at the OP, and say nothing new -- brilliant

Re: When cpan returns the dreaded "won't install without force" (ignore)
by Anonymous Monk on Mar 18, 2013 at 00:35 UTC
Re: When cpan returns the dreaded "won't install without force"
by Anonymous Monk on Mar 18, 2013 at 00:58 UTC
    It would indeed surprise me that a low-level routine was actually the root cause of the problem. What usually is the cause is that the list of prerequisites for some (directly or more-likely indirectly included) package is not quite right. A check of the CPAN bug-lists will usually reveal that. In addition, updates that are made to a dependent package without appropriate changes also being made to a module's list of self-tests can cause those self-tests to fail ... leading to this message. Again, by the time you run into glitches like this, you're not gonna be the first to do so. Check bug reports and CPANTS test-logs first.
Re: When cpan returns the dreaded "won't install without force"
by sundialsvc4 (Abbot) on Mar 18, 2013 at 13:59 UTC

    I think that it certainly would be an improvement if the failed installation session would end with a synopsis of exactly why the process failed ... and if there were routinely a log or transcript.   The output of any installation is extremely noisy.

    However, it would not be particularly easy to do this, because packages vary in age as well as in the completeness of their designs, all of which are self-contributed by whomever owns the package (or owned it at the time).   There is no single-standard.   There’s even more than one module-building framework:   when improvements to that process were introduced, package maintainers gradually over time (maybe) moved to it, but old packages that still work just fine were not re-written.   The quality-assurance such as it is (and usually, it is just fine) is self-regulated by the CPAN community.

    I have a few particular cases where the “won’t install without” scenario appears in some of the deployments that I maintain:

    1. One package requires a third-party C library, a standard one, but it assumes that the library exists.   (Perhaps this is because there is no one single known-good way to check for it on all systems?)   If it’s not there, you don’t get a prerequisite-error:   you get a nasty failure to compile, with lots of oily parts on the runway when the whole thing finally skids to a stop on the tarmac.
    2. Another package is similar:   the library has been updated and the package requires the newer one, but older deployments of it do exist out there.
    3. CPAN package re-designs have caused issues.   You can design your package any way you want to.   Someone else’s package, perhaps unbeknownst to you, uses a package feature that its owner now considers to be deprecated.   Or a test-script in your installation sequence still refers to it.   There is one package that I use which at this moment must be forced.   (Sure, I offered a patch to the test.)
    4. Windows-environment users are very familiar with the scenario where they want to use a package that was written by a person who only has access to Linux or Unix, and who therefore is not in a position to make adjustments to suit other environments ... and there are a great many environments.

    “Missing and unrealized prerequisites,” by-the-by, are a definite possibility to be dealt-with in the field.   Success of an installation depends not only upon you correctly specifying all of the pre-requisites and co-requisites of your package, but that all of them have done the same and that they forever continue to do so.   To some degree, manifests and so-forth are hand written.   If a requisite is left-out but your system does have it, you don’t necessarily recognize the existence of the problem.   On top of this, there are a few “co-dependency paradoxes” which actually oblige you to force installation of package A, in order that you can now install package B, in order that you can now properly re-install package A.   You can see this clearly if you have to deal with a scenario that rarely occurs:   installing a Perl application on an absolutely-naked system i.e. step #1 is compiling the Perl executable from scratch and so-on.   And your task is to construct an absolutely hands-free installer/updater for that case.   Attempt that, and you will find some amount of grief despite everyone else’s earnest efforts.

      I think that it certainly would be an improvement ...

      Yeah, you can get that if you use cpanp or cpanm or install CPAN::Reporter and flip on verbose and/or logging and/or debug mode

      You either head or tail the log, and you'll see the most important message

      Note: this reply is mainly going to be a redirect to a new node that takes the discussion from this point. Expect an update soon. Withhold critical judgement until then, please.

      sundialsvc4 wrote (the quotations may be slightly adjusted to add my emphasis or to enhance clarity if I thought it could be improved):

      I have a few particular cases where the “won’t install without” scenario appears in some of the deployments that I maintain:

      1. One package requires a third-party C library, a standard one, but it assumes that the library exists.   (Perhaps this is because there is no one single known-good way to check for it on all systems?)   If it’s not there, you don’t get a prerequisite-error:   you get a nasty failure to compile, with lots of oily parts on the runway when the whole thing finally skids to a stop on the tarmac.
      2. Another package is similar:   the library has been updated and the package requires the newer one, but older deployments of it do exist out there.

      “Missing and unrealized prerequisites,” by-the-by, are a definite possibility to be dealt-with in the field.

      As to the last, certainly, they are. But as an overall generalization this is far less likely when using the cpan clients to install modules. The clients prompt the user when installation of the module with unfulfilled prereqs has been requested. Not to belabor the point but this is not how the OP reported the pattern of events. No mention was made of cpan prompting her as Makefile was built-which is long before cpan states (after the test run) that it   won't install without force.

      These are good points and are scenarios that are familiar to many Perlmonks. The 2 selected statements are both about external dependencies (where “external” in this context means provisioned from outside the CPAN installer universe). Such being the case, and knowing how sticky this whole area can be, I've created a new node [at 1025019 - Dei ex machina - State of the External Dependency Arts] in which to carry on this discussion. The focus of the new write-up will be that indicated by sundialsvc4's speculation Perhaps this is because there is no one single known-good way to check for it on all systems?

      Updated 2013-03-23 GMT

      sundialsvc4, for any installation it would be nice to have an easy to read report, however, Windows command prompt is not the best place to read those reports. No matter how messy they are, a text editor would be a better environment to read those reports. I can line wrap in my text editor, so lines could be as long as they want to be, I just make them wrap so they do not force to to scroll right to read them. I went to copy a test report to write up a bug report, and one line just went on and on and on to the right, and I got so flustered I gave up trying to copy the report or write the bug report.

      I know the reasons for installations are varied, but having to read the test reports in the command prompt window on Windows is a pain.

      Have a cookie and a very nice day!
      Lady Aleena
Re: When cpan returns the dreaded "won't install without force"
by QM (Parson) on Mar 18, 2013 at 14:02 UTC
    For those with few tests which do not scroll my screen, copying the test data and Test Summary Report is easy; but for others which have a lot of tests, it is difficult to get everything from the command prompt window.
    Does tee or wintee work in this context?

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      Lately I have been using the following from an lubuntu terminal:

      #: script perl_critic.log

      #: sudo cpanm Perl::Critic

      Let the module try to install

      #: exit

      Now grep perl_critic.log for error and skipped among other message titles.

Re: When cpan returns the dreaded "won't install without force"
by DrHyde (Prior) on Mar 19, 2013 at 11:36 UTC
    You can scroll any reasonable terminal with shift-PgUp/shift-PgDn. Or if you run your terminal with GNU screen, C-a ESC makes it scrollable a line at a time using the arrow keys. And finally, if you want to log the output from the CPAN shell, pipe through tee.

      GNU screen isn't available for Windows, we're told the user is using the "command prompt" so they're probably using a Microsoft Windows machine, thought obviously it would be nice had they explicity stated the OS, rather than have people read between the lines. Every terminal I know of has a scroll back limit, so being able to page/scroll up/down is may be of little consequence given that you may be looking for something outside this configurable range, while it's wise to have this configured to sensible size. For Windows, by default the "command prompt" doesn't store a very large history at all. I agree that the sensible solution is to log this to a file yourself, or use cpanp or alike, which does this automatically.

      DrHyde, I know scrolling up and down the Windows command prompt window is easy, however selecting the text to copy and paste to a bug report is not easy. If I have to select pages upon pages of text to copy to a bug report, I can easily get lost (especially when the lines scroll to the right). If I have the report in a nice text file which I can open in a text editor, submitting bug reports would be so much easier. As far as I can tell, I can not wrap lines in my command prompt window.

      Have a cookie and a very nice day!
      Lady Aleena
        In that case you want tee(1). If it isn't installed as standard on your OS, it's trivial to write using File::Tee.
Re: When cpan returns the dreaded "won't install without force"
by pvaldes (Chaplain) on Mar 24, 2013 at 01:01 UTC

    it would be nice if I could have the text printed to my screen also printed to a file

    $ cpan install A::Module &>logfile; less logfile

      Sorry pvaldes, I did not specify earlier I was on a Windows machine. What you submitted looks like *nix. Right?

      Have a cookie and a very nice day!
      Lady Aleena

        What you submitted looks like *nix. Right?

        I can't tell, it certainly doesn't look like The Windows NT Command Shell, maybe it is powershell

        The windows cmd.exe version might look like  cpan install ...   >myUnified.log 2>&1

        or

        use Capture::Tiny qw' capture_merged '; my $log = 'myUnified.log' ; open my($fh), '>', $log or die $^E; print $fh capture_merged { system qw[ cpan install ... ]; }; close $fh; system 1, 'notepad.exe', $log;
        Yes, it's redirection of stdout and stderr to a file in bash.
Re: When cpan returns the dreaded "won't install without force"
by marto (Cardinal) on Mar 24, 2013 at 09:02 UTC

    Several times in this thread you've been advised to try an alternate cpan client which logs by default. Consider not developing on Windows if you don't want to have to work around what you consider to be shortcomings.

      As this is mine very first post here, please forgive any obvioius idiocies.

      Having rather large Perl installations on both Win and Debian, I have a little experience with install errors (as well as perhaps more questions than answers).

      For the evil spawn of Redmond, may I humbly suggest that the OP use the ActiveState version of Perl *first*, as that is precompiled for Win and the ppm's in general do not produce error messages, except for incompetent errors like two nodules putting READMEs into the same directory.

      Some modules simply do not *compile* well under Win, and I have had enough problems with Strawberry to stop using it.

      M'lady's orignial distress "wont install without force" is often enough in truth a statement that due to a missing dependency, it wont install *even with force* : It wont install at all.

      For a CPAN module probably the best place to look may not be the logs or scrollback, which I have often found confusing, but rather the META.YML files in the/Build directories, which normally state dependencies, as well as the home pages of the modules often with more info than CPAN.

      For ActiveState the basic info is in the PPM .tgz files, which must be snatched from the $TEMP directory before they are deleted - if they cannot install normally. The info is in a .PPD file. One can use a simple file manager like FAR or TOTAL COMMANDER to simply copy the internal files to the appropriate SITE/lib and binary directories (usually /bin or /SITE/bin

      For Win users I would also recommend installing CYGWIN, as it should have all the binaries that CPAN typically looks for, was well as the MingW compiler needed for some modules - even some of ActiveStates. (Else Visual C)

      As Cygwin has its own, and usually outdated Perl, I would rename the binary, and possibly the directories within it. And add its path into the Win environment. It may even be possible to totally update the Cygwin Perl using CPAN. It would certainly be more methodically pure than using tethered software such as ActiveState. (I pray RMS will forgive my sins...).

      Also, some dependencies are not on CPAN and the module authors automatically assume that they are already installed. Some are even proprietary - Mathematica and RT come to mind.

        "As this is mine very first post here, please forgive any obvioius idiocies."

        Welcome!

        "Some modules simply do not *compile* well under Win, and I have had enough problems with Strawberry to stop using it."

        Not all modules are supposed to compile under windows, if you have some examples of modules which don't compile 'well' I'd be happy to give them a try. I've been using Strawberry since it's Alpha/Beta releases and haven't experienced any serious issues.

        "For a CPAN module probably the best place to look may not be the logs or scrollback, which I have often found confusing, but rather the META.YML files in the/Build directories, which normally state dependencies, as well as the home pages of the modules often with more info than CPAN."

        Agreed, a great many (if not most) problems stem from the fact that people don't read the documentation for the module they're trying to install. I find that most moudules are good a listing their dependancies.

        "For Win users I would also recommend installing CYGWIN, as it should have all the binaries that CPAN typically looks for, was well as the MingW compiler needed for some modules - even some of ActiveStates. (Else Visual C)

        As Cygwin has its own, and usually outdated Perl, I would rename the binary, and possibly the directories within it. And add its path into the Win environment. It may even be possible to totally update the Cygwin Perl using CPAN. It would certainly be more methodically pure than using tethered software such as ActiveState. (I pray RMS will forgive my sins...)."

        I think for new or less experienced users throwing cygwin into this mix will do more harm than good, in that it'll cause more confusion than it will resolve issues. From my experience Strawberry comes with everything I need to develop with Perl on Windows. ActiveState allows you to install MinGW etc via ppm MinGW, note that they don't provide a 64 bit build. I've recently read that the ActiveState repos are falling behind in provinding modules, especially for the 64bit platform. As I don't use it I've not looked deeper into the situation myself.

        "Also, some dependencies are not on CPAN and the module authors automatically assume that they are already installed. Some are even proprietary - Mathematica and RT come to mind."

        There are non cpan dependancies with certain modules, each instance of this in my experience is detailed in the module doumentation. For various reasons some third party stuff will never be on cpan, for example where the perl module is a wrapper around a third party or propriatry libary.

        Thanks for your input.

        Update: fixed typos

      marto, I have installed and started to play with CPANPLUS very early this morning.

      Have a cookie and a very nice day!
      Lady Aleena

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1023945]
Approved by davies
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-03-19 07:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found